mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-01 08:03:31 +01:00
make socks5 not give a spurious warning
also rename AP_CONN_STATE_CONNECTING to _CONNECT_WAIT svn:r1208
This commit is contained in:
parent
77bb3e054e
commit
8275e2302c
@ -220,7 +220,7 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ, connection
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(conn->type == CONN_TYPE_AP && rh.command == RELAY_COMMAND_CONNECTED) {
|
if(conn->type == CONN_TYPE_AP && rh.command == RELAY_COMMAND_CONNECTED) {
|
||||||
if(conn->state != AP_CONN_STATE_CONNECTING) {
|
if(conn->state != AP_CONN_STATE_CONNECT_WAIT) {
|
||||||
log_fn(LOG_WARN,"Got 'connected' while not in state connecting. Dropping.");
|
log_fn(LOG_WARN,"Got 'connected' while not in state connecting. Dropping.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -445,6 +445,7 @@ int connection_edge_finished_flushing(connection_t *conn) {
|
|||||||
return 0;
|
return 0;
|
||||||
case AP_CONN_STATE_SOCKS_WAIT:
|
case AP_CONN_STATE_SOCKS_WAIT:
|
||||||
case AP_CONN_STATE_CIRCUIT_WAIT:
|
case AP_CONN_STATE_CIRCUIT_WAIT:
|
||||||
|
case AP_CONN_STATE_CONNECT_WAIT:
|
||||||
connection_stop_writing(conn);
|
connection_stop_writing(conn);
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
@ -539,7 +540,7 @@ void connection_ap_expire_beginning(void) {
|
|||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
conn = carray[i];
|
conn = carray[i];
|
||||||
if (conn->type != CONN_TYPE_AP ||
|
if (conn->type != CONN_TYPE_AP ||
|
||||||
conn->state != AP_CONN_STATE_CONNECTING)
|
conn->state != AP_CONN_STATE_CONNECT_WAIT)
|
||||||
continue;
|
continue;
|
||||||
if (now - conn->timestamp_lastread >= 15) {
|
if (now - conn->timestamp_lastread >= 15) {
|
||||||
log_fn(LOG_WARN,"Stream is %d seconds late. Retrying.",
|
log_fn(LOG_WARN,"Stream is %d seconds late. Retrying.",
|
||||||
@ -770,7 +771,7 @@ static void connection_ap_handshake_send_begin(connection_t *ap_conn, circuit_t
|
|||||||
|
|
||||||
ap_conn->package_window = STREAMWINDOW_START;
|
ap_conn->package_window = STREAMWINDOW_START;
|
||||||
ap_conn->deliver_window = STREAMWINDOW_START;
|
ap_conn->deliver_window = STREAMWINDOW_START;
|
||||||
ap_conn->state = AP_CONN_STATE_CONNECTING;
|
ap_conn->state = AP_CONN_STATE_CONNECT_WAIT;
|
||||||
/* XXX Right now, we rely on the socks client not to send us any data
|
/* XXX Right now, we rely on the socks client not to send us any data
|
||||||
* XXX until we've sent back a socks reply. (If it does, we could wind
|
* XXX until we've sent back a socks reply. (If it does, we could wind
|
||||||
* XXX up packaging that data and sending it to the exit, then later having
|
* XXX up packaging that data and sending it to the exit, then later having
|
||||||
@ -786,7 +787,7 @@ static int connection_ap_handshake_socks_reply(connection_t *conn, char *reply,
|
|||||||
|
|
||||||
if(replylen) { /* we already have a reply in mind */
|
if(replylen) { /* we already have a reply in mind */
|
||||||
connection_write_to_buf(reply, replylen, conn);
|
connection_write_to_buf(reply, replylen, conn);
|
||||||
return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); /* try to flush it */
|
return 0;
|
||||||
}
|
}
|
||||||
assert(conn->socks_request);
|
assert(conn->socks_request);
|
||||||
if(conn->socks_request->socks_version == 4) {
|
if(conn->socks_request->socks_version == 4) {
|
||||||
@ -796,7 +797,6 @@ static int connection_ap_handshake_socks_reply(connection_t *conn, char *reply,
|
|||||||
buf[1] = (success ? SOCKS4_GRANTED : SOCKS4_REJECT);
|
buf[1] = (success ? SOCKS4_GRANTED : SOCKS4_REJECT);
|
||||||
/* leave version, destport, destip zero */
|
/* leave version, destport, destip zero */
|
||||||
connection_write_to_buf(buf, SOCKS4_NETWORK_LEN, conn);
|
connection_write_to_buf(buf, SOCKS4_NETWORK_LEN, conn);
|
||||||
return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); /* try to flush it */
|
|
||||||
}
|
}
|
||||||
if(conn->socks_request->socks_version == 5) {
|
if(conn->socks_request->socks_version == 5) {
|
||||||
buf[0] = 5; /* version 5 */
|
buf[0] = 5; /* version 5 */
|
||||||
@ -808,9 +808,9 @@ static int connection_ap_handshake_socks_reply(connection_t *conn, char *reply,
|
|||||||
memset(buf+4,0,6); /* Set external addr/port to 0.
|
memset(buf+4,0,6); /* Set external addr/port to 0.
|
||||||
The spec doesn't seem to say what to do here. -RD */
|
The spec doesn't seem to say what to do here. -RD */
|
||||||
connection_write_to_buf(buf,10,conn);
|
connection_write_to_buf(buf,10,conn);
|
||||||
return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); /* try to flush it */
|
|
||||||
}
|
}
|
||||||
return 0; /* if socks_version isn't 4 or 5, don't send anything */
|
/* if socks_version isn't 4 or 5, don't send anything */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ) {
|
static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ) {
|
||||||
|
@ -216,6 +216,7 @@ static void conn_write(int i) {
|
|||||||
/* this connection is broken. remove it. */
|
/* this connection is broken. remove it. */
|
||||||
log_fn(LOG_WARN,"Unhandled error on read for %s connection (fd %d); removing",
|
log_fn(LOG_WARN,"Unhandled error on read for %s connection (fd %d); removing",
|
||||||
conn_type_to_string[conn->type], conn->s);
|
conn_type_to_string[conn->type], conn->s);
|
||||||
|
conn->has_sent_end = 1; /* otherwise we cry wolf about duplicate close */
|
||||||
connection_mark_for_close(conn,0);
|
connection_mark_for_close(conn,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@
|
|||||||
#define _AP_CONN_STATE_MIN 5
|
#define _AP_CONN_STATE_MIN 5
|
||||||
#define AP_CONN_STATE_SOCKS_WAIT 5
|
#define AP_CONN_STATE_SOCKS_WAIT 5
|
||||||
#define AP_CONN_STATE_CIRCUIT_WAIT 6
|
#define AP_CONN_STATE_CIRCUIT_WAIT 6
|
||||||
#define AP_CONN_STATE_CONNECTING 7
|
#define AP_CONN_STATE_CONNECT_WAIT 7
|
||||||
#define AP_CONN_STATE_OPEN 8
|
#define AP_CONN_STATE_OPEN 8
|
||||||
#define _AP_CONN_STATE_MAX 8
|
#define _AP_CONN_STATE_MAX 8
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user