diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-03-03 05:08:01 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-03-03 05:08:01 +0000 |
commit | f4e4dac80163625d0d1713ee8ff6c2d9f0c3d394 (patch) | |
tree | c1ff86f96ea8b10847ab71a4f26f962b9698357b /src/or/connection.c | |
parent | 8275e2302ca3995f15a0b78e7a5341230653694c (diff) | |
download | tor-f4e4dac80163625d0d1713ee8ff6c2d9f0c3d394.tar tor-f4e4dac80163625d0d1713ee8ff6c2d9f0c3d394.tar.gz |
Implement hold_open_until_flushed. I may have missed something important.
svn:r1209
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 934543c6d..30741ebea 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -209,6 +209,27 @@ _connection_mark_for_close(connection_t *conn, char reason) return retval; } +void connection_expire_held_open(void) +{ + connection_t **carray, *conn; + int n, i; + time_t now; + + now = time(NULL); + + get_connection_array(&carray, &n); + for (i = 0; i < n; ++i) { + conn = carray[i]; + /* If we've been holding the connection open, but we haven't written + * for 15 seconds... + */ + if (conn->marked_for_close && conn->hold_open_until_flushed && + now - conn->timestamp_lastwritten >= 15) { + conn->hold_open_until_flushed = 0; + } + } +} + int connection_create_listener(char *bindaddress, uint16_t bindport, int type) { struct sockaddr_in bindaddr; /* where to bind */ struct hostent *rent; |