[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] make socks5 not give a spurious warning



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	connection_edge.c main.c or.h 
Log Message:
make socks5 not give a spurious warning
also rename AP_CONN_STATE_CONNECTING to _CONNECT_WAIT


Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- connection_edge.c	2 Mar 2004 17:48:16 -0000	1.108
+++ connection_edge.c	3 Mar 2004 04:54:15 -0000	1.109
@@ -220,7 +220,7 @@
       return 0;
     }
     if(conn->type == CONN_TYPE_AP && rh.command == RELAY_COMMAND_CONNECTED) {
-      if(conn->state != AP_CONN_STATE_CONNECTING) {
+      if(conn->state != AP_CONN_STATE_CONNECT_WAIT) {
         log_fn(LOG_WARN,"Got 'connected' while not in state connecting. Dropping.");
         return 0;
       }
@@ -445,6 +445,7 @@
       return 0;
     case AP_CONN_STATE_SOCKS_WAIT:
     case AP_CONN_STATE_CIRCUIT_WAIT:
+    case AP_CONN_STATE_CONNECT_WAIT:
       connection_stop_writing(conn);
       return 0;
     default:
@@ -539,7 +540,7 @@
   for (i = 0; i < n; ++i) {
     conn = carray[i];
     if (conn->type != CONN_TYPE_AP ||
-        conn->state != AP_CONN_STATE_CONNECTING)
+        conn->state != AP_CONN_STATE_CONNECT_WAIT)
       continue;
     if (now - conn->timestamp_lastread >= 15) {
       log_fn(LOG_WARN,"Stream is %d seconds late. Retrying.",
@@ -770,7 +771,7 @@
 
   ap_conn->package_window = STREAMWINDOW_START;
   ap_conn->deliver_window = STREAMWINDOW_START;
-  ap_conn->state = AP_CONN_STATE_CONNECTING;
+  ap_conn->state = AP_CONN_STATE_CONNECT_WAIT;
   /* XXX Right now, we rely on the socks client not to send us any data
    * XXX until we've sent back a socks reply.  (If it does, we could wind
    * XXX up packaging that data and sending it to the exit, then later having
@@ -786,7 +787,7 @@
 
   if(replylen) { /* we already have a reply in mind */
     connection_write_to_buf(reply, replylen, conn);
-    return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); /* try to flush it */
+    return 0;
   }
   assert(conn->socks_request);
   if(conn->socks_request->socks_version == 4) {
@@ -796,7 +797,6 @@
     buf[1] = (success ? SOCKS4_GRANTED : SOCKS4_REJECT);
     /* leave version, destport, destip zero */
     connection_write_to_buf(buf, SOCKS4_NETWORK_LEN, conn);
-    return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); /* try to flush it */
   }
   if(conn->socks_request->socks_version == 5) {
     buf[0] = 5; /* version 5 */
@@ -808,9 +808,9 @@
     memset(buf+4,0,6); /* Set external addr/port to 0.
                           The spec doesn't seem to say what to do here. -RD */
     connection_write_to_buf(buf,10,conn);
-    return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); /* try to flush it */
   }
-  return 0; /* if socks_version isn't 4 or 5, don't send anything */
+  /* if socks_version isn't 4 or 5, don't send anything */
+  return 0;
 }
 
 static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ) {

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -d -r1.186 -r1.187
--- main.c	3 Mar 2004 02:14:35 -0000	1.186
+++ main.c	3 Mar 2004 04:54:16 -0000	1.187
@@ -216,6 +216,7 @@
       /* this connection is broken. remove it. */
       log_fn(LOG_WARN,"Unhandled error on read for %s connection (fd %d); removing",
              conn_type_to_string[conn->type], conn->s);
+      conn->has_sent_end = 1; /* otherwise we cry wolf about duplicate close */
       connection_mark_for_close(conn,0);
     }
   }

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -d -r1.241 -r1.242
--- or.h	3 Mar 2004 03:02:06 -0000	1.241
+++ or.h	3 Mar 2004 04:54:16 -0000	1.242
@@ -159,7 +159,7 @@
 #define _AP_CONN_STATE_MIN 5
 #define AP_CONN_STATE_SOCKS_WAIT 5
 #define AP_CONN_STATE_CIRCUIT_WAIT 6
-#define AP_CONN_STATE_CONNECTING 7
+#define AP_CONN_STATE_CONNECT_WAIT 7
 #define AP_CONN_STATE_OPEN 8
 #define _AP_CONN_STATE_MAX 8