diff options
-rw-r--r-- | src/or/buffers.c | 2 | ||||
-rw-r--r-- | src/or/connection_edge.c | 21 | ||||
-rw-r--r-- | src/or/or.h | 3 | ||||
-rw-r--r-- | src/or/routerlist.c | 2 |
4 files changed, 20 insertions, 8 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index d4c3dd7875..55a4bced99 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -491,6 +491,8 @@ int fetch_from_buf_socks(buf_t *buf, socks_request_t *req) { } 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? */ diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 351133c444..fb4b424278 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -540,6 +540,7 @@ repeat_connection_edge_package_raw_inbuf: 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 @@ void connection_ap_expire_beginning(void) { 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 @@ void connection_ap_expire_beginning(void) { /* 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 */ diff --git a/src/or/or.h b/src/or/or.h index 84439a334f..47a3474815 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -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 @@ struct connection_t { 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; diff --git a/src/or/routerlist.c b/src/or/routerlist.c index d0acebad81..bfd5935597 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -846,7 +846,7 @@ routerinfo_t *router_get_entry_from_string(const char *s, 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) { |