mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Replaced ST_* enum prefix for stream status with IO_STREAM_*.
This commit is contained in:
parent
a8f21f91cf
commit
14c5a24fe7
@ -3140,10 +3140,10 @@ tor_spawn_background(const char *const filename, int *stdout_read,
|
|||||||
* fits your needs before using it.
|
* fits your needs before using it.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* ST_CLOSED: If the stream is closed.
|
* IO_STREAM_CLOSED: If the stream is closed.
|
||||||
* ST_EAGAIN: If there is nothing to read and we should check back later.
|
* IO_STREAM_EAGAIN: If there is nothing to read and we should check back later.
|
||||||
* ST_TERM: If something is wrong with the stream.
|
* IO_STREAM_TERM: If something is wrong with the stream.
|
||||||
* ST_OKAY: If everything went okay and we got a string in <b>buf_out</b>. */
|
* IO_STREAM_OKAY: If everything went okay and we got a string in <b>buf_out</b>. */
|
||||||
enum stream_status
|
enum stream_status
|
||||||
get_string_from_pipe(FILE *stream, char *buf_out, size_t count)
|
get_string_from_pipe(FILE *stream, char *buf_out, size_t count)
|
||||||
{
|
{
|
||||||
@ -3156,14 +3156,14 @@ get_string_from_pipe(FILE *stream, char *buf_out, size_t count)
|
|||||||
if (feof(stream)) {
|
if (feof(stream)) {
|
||||||
/* Program has closed stream (probably it exited) */
|
/* Program has closed stream (probably it exited) */
|
||||||
/* TODO: check error */
|
/* TODO: check error */
|
||||||
return ST_CLOSED;
|
return IO_STREAM_CLOSED;
|
||||||
} else {
|
} else {
|
||||||
if (EAGAIN == errno) {
|
if (EAGAIN == errno) {
|
||||||
/* Nothing more to read, try again next time */
|
/* Nothing more to read, try again next time */
|
||||||
return ST_EAGAIN;
|
return IO_STREAM_EAGAIN;
|
||||||
} else {
|
} else {
|
||||||
/* There was a problem, abandon this child process */
|
/* There was a problem, abandon this child process */
|
||||||
return ST_TERM;
|
return IO_STREAM_TERM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3175,11 +3175,11 @@ get_string_from_pipe(FILE *stream, char *buf_out, size_t count)
|
|||||||
buf_out[len - 1] = '\0';
|
buf_out[len - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ST_OKAY;
|
return IO_STREAM_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We should never get here */
|
/* We should never get here */
|
||||||
return ST_TERM;
|
return IO_STREAM_TERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Read from stream, and send lines to log at the specified log level.
|
/** Read from stream, and send lines to log at the specified log level.
|
||||||
|
@ -281,10 +281,10 @@ ssize_t read_all(tor_socket_t fd, char *buf, size_t count, int isSocket);
|
|||||||
|
|
||||||
/** Status of an I/O stream. */
|
/** Status of an I/O stream. */
|
||||||
enum stream_status {
|
enum stream_status {
|
||||||
ST_OKAY,
|
IO_STREAM_OKAY,
|
||||||
ST_EAGAIN,
|
IO_STREAM_EAGAIN,
|
||||||
ST_TERM,
|
IO_STREAM_TERM,
|
||||||
ST_CLOSED
|
IO_STREAM_CLOSED
|
||||||
};
|
};
|
||||||
|
|
||||||
enum stream_status get_string_from_pipe(FILE *stream, char *buf, size_t count);
|
enum stream_status get_string_from_pipe(FILE *stream, char *buf, size_t count);
|
||||||
|
@ -163,14 +163,14 @@ configure_proxy(managed_proxy_t *mp)
|
|||||||
r = get_string_from_pipe(mp->stdout, stdout_buf,
|
r = get_string_from_pipe(mp->stdout, stdout_buf,
|
||||||
sizeof(stdout_buf) - 1);
|
sizeof(stdout_buf) - 1);
|
||||||
|
|
||||||
if (r == ST_CLOSED || r == ST_TERM) {
|
if (r == IO_STREAM_CLOSED || r == IO_STREAM_TERM) {
|
||||||
log_warn(LD_GENERAL, "Managed proxy stream closed. "
|
log_warn(LD_GENERAL, "Managed proxy stream closed. "
|
||||||
"Most probably application stopped running");
|
"Most probably application stopped running");
|
||||||
mp->conf_state = PT_PROTO_BROKEN;
|
mp->conf_state = PT_PROTO_BROKEN;
|
||||||
} else if (r == ST_EAGAIN) {
|
} else if (r == IO_STREAM_EAGAIN) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
tor_assert(r == ST_OKAY);
|
tor_assert(r == IO_STREAM_OKAY);
|
||||||
handle_proxy_line(stdout_buf, mp);
|
handle_proxy_line(stdout_buf, mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user