Bläddra i källkod

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

Nick Mathewson 17 år sedan
förälder
incheckning
9d1af71b70
3 ändrade filer med 18 tillägg och 19 borttagningar
  1. 0 18
      src/or/connection.c
  2. 18 0
      src/or/main.c
  3. 0 1
      src/or/or.h

+ 0 - 18
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 <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. */

+ 18 - 0
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 <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. */

+ 0 - 1
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);