From 9d1af71b70d7f7253976e97633fd4d1e1d395d77 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 29 May 2007 18:20:56 +0000 Subject: [PATCH] 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 --- src/or/connection.c | 18 ------------------ src/or/main.c | 18 ++++++++++++++++++ src/or/or.h | 1 - 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/or/connection.c b/src/or/connection.c index cfc00e3e5c..1cfe419f52 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -2277,24 +2277,6 @@ connection_state_is_connecting(connection_t *conn) return 0; } -/* XXXX020 move this into main.c */ -/** Return true iff conn 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 authenticator. Returns it * if success, else returns NULL. */ diff --git a/src/or/main.c b/src/or/main.c index ce0d6bce75..b9fd747360 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -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 conn 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 conn from * its linked connection, if it is not doing so already. Called by * connection_start_reading and connection_start_writing as appropriate. */ diff --git a/src/or/or.h b/src/or/or.h index fb2f51a81a..8d9d52ee7c 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -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);