aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-08-05 09:59:11 -0700
committerNick Mathewson <nickm@torproject.org>2010-09-27 12:29:43 -0400
commitec10c044fb3e7b4865a7e9082c5353876e40915f (patch)
tree8ab4dd41f3597825d9df094004dd50d19eeb5e29 /src
parent63079efb87ab677738ba83d13e3e9d1b0ac1c513 (diff)
downloadtor-ec10c044fb3e7b4865a7e9082c5353876e40915f.tar
tor-ec10c044fb3e7b4865a7e9082c5353876e40915f.tar.gz
Move the "stop writing when the buffer is empty" logic to cnnection_finished_flushing
Diffstat (limited to 'src')
-rw-r--r--src/or/connection.c3
-rw-r--r--src/or/connection_edge.c2
-rw-r--r--src/or/connection_or.c1
-rw-r--r--src/or/control.c2
-rw-r--r--src/or/cpuworker.c1
-rw-r--r--src/or/directory.c1
-rw-r--r--src/or/or.h4
7 files changed, 7 insertions, 7 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index a68ba7748..ff5c4c04a 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -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));
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 1488f5a89..edc58a0cf 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -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);
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index cb2c429e9..169f14153 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -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);
diff --git a/src/or/control.c b/src/or/control.c
index 436ee2ba8..ac004b558 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2719,8 +2719,6 @@ int
connection_control_finished_flushing(control_connection_t *conn)
{
tor_assert(conn);
-
- connection_stop_writing(TO_CONN(conn));
return 0;
}
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 07a1c2fb0..a9c29d288 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -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;
}
diff --git a/src/or/directory.c b/src/or/directory.c
index 7f8d1167b..2e9770eeb 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -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.");
diff --git a/src/or/or.h b/src/or/or.h
index e82cd4e1b..8f875731f 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -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? */