r13053@catbus: nickm | 2007-05-29 13:35:33 -0400

Move connection_should_read_from_linked_conn into main.c, which is the only file that uses it.


svn:r10394
This commit is contained in:
Nick Mathewson 2007-05-29 18:20:56 +00:00
parent f89a3b1448
commit 9d1af71b70
3 changed files with 18 additions and 19 deletions

View File

@ -2277,24 +2277,6 @@ connection_state_is_connecting(connection_t *conn)
return 0;
}
/* XXXX020 move this into main.c */
/** Return true iff <b>conn</b> is linked conn, and reading from the conn
* linked to it would be good and feasible. (Reading is "feasible" if the
* other conn exists and has data in its outbuf, and is "good" if we have our
* reading_from_linked_conn flag set and the other conn has its
* writing_to_linked_conn flag set.)*/
int
connection_should_read_from_linked_conn(connection_t *conn)
{
if (conn->linked && conn->reading_from_linked_conn) {
if (! conn->linked_conn ||
(conn->linked_conn->writing_to_linked_conn &&
buf_datalen(conn->linked_conn->outbuf)))
return 1;
}
return 0;
}
/** Allocates a base64'ed authenticator for use in http or https
* auth, based on the input string <b>authenticator</b>. Returns it
* if success, else returns NULL. */

View File

@ -29,6 +29,7 @@ static void signal_callback(int fd, short events, void *arg);
static void second_elapsed_callback(int fd, short event, void *args);
static int conn_close_if_marked(int i);
static void connection_start_reading_from_linked_conn(connection_t *conn);
static int connection_should_read_from_linked_conn(connection_t *conn);
/********* START VARIABLES **********/
@ -399,6 +400,23 @@ connection_start_writing(connection_t *conn)
}
}
/** Return true iff <b>conn</b> is linked conn, and reading from the conn
* linked to it would be good and feasible. (Reading is "feasible" if the
* other conn exists and has data in its outbuf, and is "good" if we have our
* reading_from_linked_conn flag set and the other conn has its
* writing_to_linked_conn flag set.)*/
static int
connection_should_read_from_linked_conn(connection_t *conn)
{
if (conn->linked && conn->reading_from_linked_conn) {
if (! conn->linked_conn ||
(conn->linked_conn->writing_to_linked_conn &&
buf_datalen(conn->linked_conn->outbuf)))
return 1;
}
return 0;
}
/** Helper: Tell the main loop to begin reading bytes into <b>conn</b> from
* its linked connection, if it is not doing so already. Called by
* connection_start_reading and connection_start_writing as appropriate. */

View File

@ -2357,7 +2357,6 @@ connection_t *connection_get_by_type_state_rendquery(int type, int state,
int connection_is_listener(connection_t *conn);
int connection_state_is_open(connection_t *conn);
int connection_state_is_connecting(connection_t *conn);
int connection_should_read_from_linked_conn(connection_t *conn);
char *alloc_http_authenticator(const char *authenticator);