mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Move the "stop writing when the buffer is empty" logic to cnnection_finished_flushing
This commit is contained in:
parent
63079efb87
commit
ec10c044fb
@ -3430,6 +3430,9 @@ connection_finished_flushing(connection_t *conn)
|
||||
|
||||
// log_fn(LOG_DEBUG,"entered. Socket %u.", conn->s);
|
||||
|
||||
IF_HAS_NO_BUFFEREVENT(conn)
|
||||
connection_stop_writing(conn);
|
||||
|
||||
switch (conn->type) {
|
||||
case CONN_TYPE_OR:
|
||||
return connection_or_finished_flushing(TO_OR_CONN(conn));
|
||||
|
@ -319,7 +319,6 @@ connection_edge_finished_flushing(edge_connection_t *conn)
|
||||
switch (conn->_base.state) {
|
||||
case AP_CONN_STATE_OPEN:
|
||||
case EXIT_CONN_STATE_OPEN:
|
||||
connection_stop_writing(TO_CONN(conn));
|
||||
connection_edge_consider_sending_sendme(conn);
|
||||
return 0;
|
||||
case AP_CONN_STATE_SOCKS_WAIT:
|
||||
@ -328,7 +327,6 @@ connection_edge_finished_flushing(edge_connection_t *conn)
|
||||
case AP_CONN_STATE_CIRCUIT_WAIT:
|
||||
case AP_CONN_STATE_CONNECT_WAIT:
|
||||
case AP_CONN_STATE_CONTROLLER_WAIT:
|
||||
connection_stop_writing(TO_CONN(conn));
|
||||
return 0;
|
||||
default:
|
||||
log_warn(LD_BUG, "Called in unexpected state %d.",conn->_base.state);
|
||||
|
@ -281,7 +281,6 @@ connection_or_finished_flushing(or_connection_t *conn)
|
||||
case OR_CONN_STATE_PROXY_HANDSHAKING:
|
||||
case OR_CONN_STATE_OPEN:
|
||||
case OR_CONN_STATE_OR_HANDSHAKING:
|
||||
connection_stop_writing(TO_CONN(conn));
|
||||
break;
|
||||
default:
|
||||
log_err(LD_BUG,"Called in unexpected state %d.", conn->_base.state);
|
||||
|
@ -2719,8 +2719,6 @@ int
|
||||
connection_control_finished_flushing(control_connection_t *conn)
|
||||
{
|
||||
tor_assert(conn);
|
||||
|
||||
connection_stop_writing(TO_CONN(conn));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,6 @@ connection_cpu_finished_flushing(connection_t *conn)
|
||||
{
|
||||
tor_assert(conn);
|
||||
tor_assert(conn->type == CONN_TYPE_CPUWORKER);
|
||||
connection_stop_writing(conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3355,7 +3355,6 @@ connection_dir_finished_flushing(dir_connection_t *conn)
|
||||
case DIR_CONN_STATE_CLIENT_SENDING:
|
||||
log_debug(LD_DIR,"client finished sending command.");
|
||||
conn->_base.state = DIR_CONN_STATE_CLIENT_READING;
|
||||
connection_stop_writing(TO_CONN(conn));
|
||||
return 0;
|
||||
case DIR_CONN_STATE_SERVER_WRITING:
|
||||
log_debug(LD_DIRSERV,"Finished writing server response. Closing.");
|
||||
|
@ -1312,10 +1312,14 @@ static INLINE control_connection_t *TO_CONTROL_CONN(connection_t *c)
|
||||
stmt ; \
|
||||
} while (0)
|
||||
#define ELSE_IF_NO_BUFFEREVENT ; else
|
||||
#define IF_HAS_NO_BUFFEREVENT(c) \
|
||||
if (NULL == (c)->bufev)
|
||||
#else
|
||||
#define HAS_BUFFEREVENT(c) (0)
|
||||
#define IF_HAS_BUFFEREVENT(c, stmt) (void)0
|
||||
#define ELSE_IF_NO_BUFFEREVENT ;
|
||||
#define IF_HAS_NO_BUFFEREVENT(c) \
|
||||
if (1)
|
||||
#endif
|
||||
|
||||
/** What action type does an address policy indicate: accept or reject? */
|
||||
|
Loading…
Reference in New Issue
Block a user