[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Add new end stream reasons to maintainance branch. Fix bug ...
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] Add new end stream reasons to maintainance branch. Fix bug ...
- From: nickm@xxxxxxxx (Nick Mathewson)
- Date: Tue, 1 Mar 2005 17:13:07 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Tue, 01 Mar 2005 17:13:29 -0500
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv20539/src/or
Modified Files:
Tag: tor-0_0_9-patches
connection.c connection_edge.c or.h relay.c
Log Message:
Add new end stream reasons to maintainance branch. Fix bug where reason (8) could trigger an assert. Prevent bug from recurring.
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.310.2.4
retrieving revision 1.310.2.5
diff -u -d -r1.310.2.4 -r1.310.2.5
--- connection.c 4 Feb 2005 02:52:43 -0000 1.310.2.4
+++ connection.c 1 Mar 2005 22:13:04 -0000 1.310.2.5
@@ -855,7 +855,7 @@
connection_close_immediate(conn); /* Don't flush; connection is dead. */
if (conn->type == CONN_TYPE_AP || conn->type == CONN_TYPE_EXIT) {
connection_edge_end(conn, (char)(connection_state_is_open(conn) ?
- END_STREAM_REASON_MISC : END_STREAM_REASON_CONNECTFAILED),
+ END_STREAM_REASON_MISC : END_STREAM_REASON_CONNECTREFUSED),
conn->cpath_layer);
}
connection_mark_for_close(conn);
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.264.2.8
retrieving revision 1.264.2.9
diff -u -d -r1.264.2.8 -r1.264.2.9
--- connection_edge.c 5 Feb 2005 23:55:29 -0000 1.264.2.8
+++ connection_edge.c 1 Mar 2005 22:13:04 -0000 1.264.2.9
@@ -940,7 +940,7 @@
log_fn(LOG_DEBUG,"about to try connecting");
switch (connection_connect(conn, conn->address, addr, port)) {
case -1:
- connection_edge_end(conn, END_STREAM_REASON_CONNECTFAILED, conn->cpath_layer);
+ connection_edge_end(conn, END_STREAM_REASON_CONNECTREFUSED, conn->cpath_layer);
circuit_detach_stream(circuit_get_by_conn(conn), conn);
connection_free(conn);
return;
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.508.2.13
retrieving revision 1.508.2.14
diff -u -d -r1.508.2.13 -r1.508.2.14
--- or.h 19 Feb 2005 03:42:28 -0000 1.508.2.13
+++ or.h 1 Mar 2005 22:13:04 -0000 1.508.2.14
@@ -391,16 +391,18 @@
#define RELAY_COMMAND_RENDEZVOUS_ESTABLISHED 39
#define RELAY_COMMAND_INTRODUCE_ACK 40
-#define _MIN_END_STREAM_REASON 1
#define END_STREAM_REASON_MISC 1
#define END_STREAM_REASON_RESOLVEFAILED 2
-#define END_STREAM_REASON_CONNECTFAILED 3
+#define END_STREAM_REASON_CONNECTREFUSED 3
#define END_STREAM_REASON_EXITPOLICY 4
#define END_STREAM_REASON_DESTROY 5
#define END_STREAM_REASON_DONE 6
#define END_STREAM_REASON_TIMEOUT 7
-#define END_STREAM_REASON_RESOURCELIMIT 8
-#define _MAX_END_STREAM_REASON 8
+/* 8 is unallocated. */
+#define END_STREAM_REASON_HIBERNATING 9
+#define END_STREAM_REASON_INTERNAL 10
+#define END_STREAM_REASON_RESOURCELIMIT 11
+#define END_STREAM_REASON_CONNRESET 12
#define RESOLVED_TYPE_IPV4 4
#define RESOLVED_TYPE_IPV6 6
Index: relay.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/relay.c,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -u -d -r1.32 -r1.32.2.1
--- relay.c 13 Dec 2004 02:23:22 -0000 1.32
+++ relay.c 1 Mar 2005 22:13:04 -0000 1.32.2.1
@@ -460,21 +460,22 @@
log_fn(LOG_WARN,"End cell arrived with length 0. Should be at least 1.");
return "MALFORMED";
}
- if (*payload < _MIN_END_STREAM_REASON || *payload > _MAX_END_STREAM_REASON) {
- log_fn(LOG_WARN,"Reason for ending (%d) not recognized.",*payload);
- return "MALFORMED";
- }
switch (*payload) {
case END_STREAM_REASON_MISC: return "misc error";
case END_STREAM_REASON_RESOLVEFAILED: return "resolve failed";
- case END_STREAM_REASON_CONNECTFAILED: return "connect failed";
+ case END_STREAM_REASON_CONNECTREFUSED: return "connection refused";
case END_STREAM_REASON_EXITPOLICY: return "exit policy failed";
case END_STREAM_REASON_DESTROY: return "destroyed";
case END_STREAM_REASON_DONE: return "closed normally";
case END_STREAM_REASON_TIMEOUT: return "gave up (timeout)";
+ case END_STREAM_REASON_HIBERNATING: return "server is hibernating";
+ case END_STREAM_REASON_INTERNAL: return "internal error at server";
+ case END_STREAM_REASON_RESOURCELIMIT: return "server out of resources";
+ case END_STREAM_REASON_CONNRESET: return "connection reset";
+ default:
+ log_fn(LOG_WARN,"Reason for ending (%d) not recognized.",*payload);
+ return "unknown";
}
- tor_assert(0);
- return "";
}
/** How many times will I retry a stream that fails due to DNS