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

[or-cvs] when we fail due to resource limit, start saying so in our



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

Modified Files:
      Tag: tor-0_0_9-patches
	connection_edge.c dns.c or.h 
Log Message:
when we fail due to resource limit, start saying so in our
end cells. need to do this for other situations too.

also, fix a double-end.


Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.264.2.1
retrieving revision 1.264.2.2
diff -u -d -r1.264.2.1 -r1.264.2.2
--- connection_edge.c	24 Dec 2004 09:44:45 -0000	1.264.2.1
+++ connection_edge.c	28 Jan 2005 06:07:54 -0000	1.264.2.2
@@ -841,7 +841,8 @@
       return 0;
     case -1: /* resolve failed */
       log_fn(LOG_INFO,"Resolve failed (%s).", n_stream->address);
-      connection_edge_end(n_stream, END_STREAM_REASON_RESOLVEFAILED, n_stream->cpath_layer);
+      if (!n_stream->marked_for_close)
+        connection_edge_end(n_stream, END_STREAM_REASON_RESOLVEFAILED, n_stream->cpath_layer);
       connection_free(n_stream);
       break;
     case 0: /* resolve added to pending list */

Index: dns.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.126.2.5
retrieving revision 1.126.2.6
diff -u -d -r1.126.2.5 -r1.126.2.6
--- dns.c	28 Jan 2005 06:01:00 -0000	1.126.2.5
+++ dns.c	28 Jan 2005 06:07:54 -0000	1.126.2.6
@@ -282,7 +282,7 @@
     log_fn(LOG_WARN,"no idle dns workers. Failing.");
     if (exitconn->purpose == EXIT_PURPOSE_RESOLVE)
       send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR_TRANSIENT);
-    dns_cancel_pending_resolve(exitconn->address);
+    dns_cancel_pending_resolve(exitconn->address); /* also marks it */
     return -1;
   }
 
@@ -414,7 +414,8 @@
     pendconn = pend->conn;
     tor_assert(pendconn->s == -1);
     if (!pendconn->marked_for_close) {
-      connection_edge_end(pendconn, END_STREAM_REASON_MISC, pendconn->cpath_layer);
+      connection_edge_end(pendconn, END_STREAM_REASON_RESOURCELIMIT,
+                          pendconn->cpath_layer);
     }
     circ = circuit_get_by_conn(pendconn);
     if (circ)

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.508.2.7
retrieving revision 1.508.2.8
diff -u -d -r1.508.2.7 -r1.508.2.8
--- or.h	10 Jan 2005 04:36:47 -0000	1.508.2.7
+++ or.h	28 Jan 2005 06:07:54 -0000	1.508.2.8
@@ -397,7 +397,8 @@
 #define END_STREAM_REASON_DESTROY 5
 #define END_STREAM_REASON_DONE 6
 #define END_STREAM_REASON_TIMEOUT 7
-#define _MAX_END_STREAM_REASON 7
+#define END_STREAM_REASON_RESOURCELIMIT 8
+#define _MAX_END_STREAM_REASON 8
 
 #define RESOLVED_TYPE_IPV4 4
 #define RESOLVED_TYPE_IPV6 6