diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-07-13 12:12:16 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-07-13 12:12:16 -0400 |
commit | 1aab5b6b391ca179d9acded9465ee4941ec4700b (patch) | |
tree | d9f4426a604f0f75e8a422b0f4e8181776374124 /src/or/connection_edge.c | |
parent | 9a6642f6f5681fe92b17b87304126d2a3b2dec02 (diff) | |
parent | 16c5a62a66098274dde726c8e02110238866fe0b (diff) | |
download | tor-1aab5b6b391ca179d9acded9465ee4941ec4700b.tar.gz tor-1aab5b6b391ca179d9acded9465ee4941ec4700b.zip |
Merge remote-tracking branch 'public/bug1666'
Conflicts:
doc/spec/socks-extensions.txt
src/or/buffers.c
src/or/config.c
src/or/connection_edge.c
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 7516716fb1..c19e8b74d6 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2145,6 +2145,7 @@ connection_ap_handshake_process_socks(edge_connection_t *conn) socks_request_t *socks; int sockshere; const or_options_t *options = get_options(); + int had_reply = 0; tor_assert(conn); tor_assert(conn->_base.type == CONN_TYPE_AP); @@ -2162,22 +2163,18 @@ connection_ap_handshake_process_socks(edge_connection_t *conn) sockshere = fetch_from_buf_socks(conn->_base.inbuf, socks, options->TestSocks, options->SafeSocks); }; + + if (socks->replylen) { + had_reply = 1; + connection_write_to_buf(socks->reply, socks->replylen, TO_CONN(conn)); + socks->replylen = 0; + } + if (sockshere == 0) { - if (socks->replylen) { - connection_write_to_buf(socks->reply, socks->replylen, TO_CONN(conn)); - /* zero it out so we can do another round of negotiation */ - socks->replylen = 0; - } else { - log_debug(LD_APP,"socks handshake not all here yet."); - } + log_debug(LD_APP,"socks handshake not all here yet."); return 0; } else if (sockshere == -1) { - if (socks->replylen) { /* we should send reply back */ - log_debug(LD_APP,"reply is already set for us. Using it."); - connection_ap_handshake_socks_reply(conn, socks->reply, socks->replylen, - END_STREAM_REASON_SOCKSPROTOCOL); - - } else { + if (!had_reply) { log_warn(LD_APP,"Fetching socks handshake failed. Closing."); connection_ap_handshake_socks_reply(conn, NULL, 0, END_STREAM_REASON_SOCKSPROTOCOL); |