[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] re-try streams at most 4 times
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
buffers.c connection_edge.c or.h routerlist.c
Log Message:
re-try streams at most 4 times
Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- buffers.c 3 Mar 2004 22:49:15 -0000 1.67
+++ buffers.c 7 Mar 2004 23:50:15 -0000 1.68
@@ -491,6 +491,8 @@
}
assert(0);
case 4: /* socks4 */
+ /* http://archive.socks.permeo.com/protocol/socks4.protocol */
+ /* http://archive.socks.permeo.com/protocol/socks4a.protocol */
req->socks_version = 4;
if(buf->datalen < SOCKS4_NETWORK_LEN) /* basic info available? */
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- connection_edge.c 6 Mar 2004 05:10:07 -0000 1.113
+++ connection_edge.c 7 Mar 2004 23:50:15 -0000 1.114
@@ -540,6 +540,7 @@
goto repeat_connection_edge_package_raw_inbuf;
}
+#define MAX_STREAM_RETRIES 4
void connection_ap_expire_beginning(void) {
connection_t **carray;
connection_t *conn;
@@ -554,18 +555,24 @@
if (conn->type != CONN_TYPE_AP ||
conn->state != AP_CONN_STATE_CONNECT_WAIT)
continue;
- if (now - conn->timestamp_lastread >= 15) {
+ if (now - conn->timestamp_lastread < 15)
+ continue;
+ conn->num_retries++;
+ circ = circuit_get_by_conn(conn);
+ if(conn->num_retries >= MAX_STREAM_RETRIES) {
+ log_fn(LOG_WARN,"Stream is %d seconds late. Giving up.",
+ 15*conn->num_retries);
+ circuit_log_path(LOG_WARN, circ);
+ connection_mark_for_close(conn,END_STREAM_REASON_TIMEOUT);
+ } else {
log_fn(LOG_WARN,"Stream is %d seconds late. Retrying.",
(int)(now - conn->timestamp_lastread));
- circ = circuit_get_by_conn(conn);
circuit_log_path(LOG_WARN, circ);
/* send an end down the circuit */
connection_edge_end(conn, END_STREAM_REASON_TIMEOUT, conn->cpath_layer);
/* un-mark it as ending, since we're going to reuse it */
conn->has_sent_end = 0;
- /* move it back into 'pending' state. It's possible it will
- * reattach to this same circuit, but that's good enough for now.
- */
+ /* move it back into 'pending' state. */
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
circuit_detach_stream(circ, conn);
/* kludge to make us not try this circuit again, yet to allow
@@ -580,8 +587,8 @@
/* Don't need to send end -- we're not connected */
connection_mark_for_close(conn, 0);
}
- }
- }
+ } /* end if max_retries */
+ } /* end for */
}
/* Tell any APs that are waiting for a new circuit that one is available */
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.245
retrieving revision 1.246
diff -u -d -r1.245 -r1.246
--- or.h 5 Mar 2004 05:48:28 -0000 1.245
+++ or.h 7 Mar 2004 23:50:15 -0000 1.246
@@ -189,6 +189,8 @@
#define RELAY_COMMAND_TRUNCATE 8
#define RELAY_COMMAND_TRUNCATED 9
#define RELAY_COMMAND_DROP 10
+#define RELAY_COMMAND_RESOLVE 11
+#define RELAY_COMMAND_RESOLVED 12
#define _MIN_END_STREAM_REASON 1
#define END_STREAM_REASON_MISC 1
@@ -363,6 +365,7 @@
int done_receiving;
char has_sent_end; /* for debugging: set once we've set the stream end,
and check in circuit_about_to_close_connection() */
+ char num_retries; /* how many times have we re-tried beginning this stream? */
/* Used only by AP connections */
socks_request_t *socks_request;
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- routerlist.c 5 Mar 2004 05:48:28 -0000 1.31
+++ routerlist.c 7 Mar 2004 23:50:15 -0000 1.32
@@ -846,7 +846,7 @@
tok = find_first_by_keyword(tokens, K_PORTS);
if (tok && ports_set) {
- log_fn(LOG_WARN,"Rendundant ports line");
+ log_fn(LOG_WARN,"Redundant ports line");
goto err;
} else if (tok) {
if (tok->n_args != 3) {