diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-03-01 22:16:15 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-03-01 22:16:15 +0000 |
commit | 4ddf768a4fc98bfc2e18a7076bd0397967e3de5e (patch) | |
tree | 8049eb9dec027b429757925cce70f724c8151a8e /src/or/connection_edge.c | |
parent | 59ec8ca3f1bbc20a982d1047666cd9483bb07704 (diff) | |
download | tor-4ddf768a4fc98bfc2e18a7076bd0397967e3de5e.tar.gz tor-4ddf768a4fc98bfc2e18a7076bd0397967e3de5e.zip |
Forward-port new reasons; clean up code more; add code to convert new reasons to SOCKS5 reply codes; add code to convert errnos to reasons. New code still needs to get invoked.
svn:r3719
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index cfee2ac5e5..937b282e10 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -875,21 +875,21 @@ void connection_ap_handshake_socks_resolved(connection_t *conn, /* SOCKS5 */ buf[0] = 0x05; /* version */ if (answer_type == RESOLVED_TYPE_IPV4 && answer_len == 4) { - buf[1] = 0; /* succeeded */ + buf[1] = SOCKS5_SUCCEEDED; buf[2] = 0; /* reserved */ buf[3] = 0x01; /* IPv4 address type */ memcpy(buf+4, answer, 4); /* address */ set_uint16(buf+8, 0); /* port == 0. */ replylen = 10; } else if (answer_type == RESOLVED_TYPE_IPV6 && answer_len == 16) { - buf[1] = 0; /* succeeded */ + buf[1] = SOCKS5_SUCCEEDED; buf[2] = 0; /* reserved */ buf[3] = 0x04; /* IPv6 address type */ memcpy(buf+4, answer, 16); /* address */ set_uint16(buf+20, 0); /* port == 0. */ replylen = 22; } else { - buf[1] = 0x04; /* host unreachable */ + buf[1] = SOCKS5_HOST_UNREACHABLE; memset(buf+2, 0, 8); replylen = 10; } @@ -1156,7 +1156,8 @@ connection_exit_connect(connection_t *conn) { 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; |