aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-11-17 03:34:58 +0000
committerNick Mathewson <nickm@torproject.org>2006-11-17 03:34:58 +0000
commite2abc727e5ee08037eb79615ca81d52f6d14ef07 (patch)
tree1fe26481a4c26bda3437a36214bf169d18611cc8 /src/or/connection_edge.c
parentd125c61e02743d5420567f954a176baeaa4f76a9 (diff)
downloadtor-e2abc727e5ee08037eb79615ca81d52f6d14ef07.tar
tor-e2abc727e5ee08037eb79615ca81d52f6d14ef07.tar.gz
r9561@Kushana: nickm | 2006-11-16 22:32:54 -0500
Tweaks to test-connection patch: use ".noconnect" instead of ".test" (since there are lots of ways to test things). Use a regular sequence of STREAM events (NEW followed by CLOSED) instead of a new event type. Make the function that checks the address be static and use const and strcasecmpend properly. svn:r8959
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 6d3b482d6..ada9a4a40 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -30,6 +30,7 @@ static smartlist_t *redirect_exit_list = NULL;
static int connection_ap_handshake_process_socks(edge_connection_t *conn);
static int connection_ap_process_natd(edge_connection_t *conn);
static int connection_exit_connect_dir(edge_connection_t *exit_conn);
+static int hostname_is_noconnect_address(const char *address);
/** An AP stream has failed/finished. If it hasn't already sent back
* a socks reply, send one now (based on endreason). Also set
@@ -1395,8 +1396,8 @@ connection_ap_get_original_destination(edge_connection_t *conn,
* If the handshake is complete, send it to
* connection_ap_handshake_rewrite_and_attach().
*
- * Return -1 if an unexpected error with conn (and it should be marked
- * for close), else return 0.
+ * Return -1 if an unexpected error with conn ocurrs (and mark it for close),
+ * else return 0.
*/
static int
connection_ap_handshake_process_socks(edge_connection_t *conn)
@@ -1440,10 +1441,11 @@ connection_ap_handshake_process_socks(edge_connection_t *conn)
return -1;
} /* else socks handshake is done, continue processing */
- if (hostname_is_a_test_address(socks->address))
+ if (hostname_is_noconnect_address(socks->address))
{
- control_event_teststream(conn);
- connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
+ control_event_stream_status(conn, STREAM_EVENT_NEW, 0);
+ control_event_stream_status(conn, STREAM_EVENT_CLOSED, 0);
+ connection_mark_unattached_ap(conn, END_STREAM_REASON_DONE);
return -1;
}
@@ -2457,16 +2459,11 @@ failed:
return BAD_HOSTNAME;
}
-/** Check if the address is of the form "y.test"
+/** Check if the address is of the form "y.noconnect"
*/
-int
-hostname_is_a_test_address(char *address)
+static int
+hostname_is_noconnect_address(const char *address)
{
- char *s;
- s = strrchr(address,'.');
- if (!s)
- return 0;
- if (!strcmp(s+1,"test"))
- return 1;
- return 0;
+ return ! strcasecmpend(address, ".noconnect");
}
+