[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Patch from adam langley: always remove sockets from libeven...
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] Patch from adam langley: always remove sockets from libeven...
- From: nickm@xxxxxxxx (Nick Mathewson)
- Date: Wed, 9 Feb 2005 18:16:34 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Wed, 09 Feb 2005 18:16:58 -0500
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv7496
Modified Files:
connection.c
Log Message:
Patch from adam langley: always remove sockets from libevent before closing them. Should fix epoll-related bugs.
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.322
retrieving revision 1.323
diff -u -d -r1.322 -r1.323
--- connection.c 3 Feb 2005 22:58:22 -0000 1.322
+++ connection.c 9 Feb 2005 23:16:31 -0000 1.323
@@ -163,10 +163,6 @@
tor_free(conn->nickname);
tor_free(conn->socks_request);
- if (conn->s >= 0) {
- log_fn(LOG_INFO,"closing fd %d.",conn->s);
- tor_close_socket(conn->s);
- }
if (conn->read_event) {
event_del(conn->read_event);
tor_free(conn->read_event);
@@ -175,6 +171,11 @@
event_del(conn->write_event);
tor_free(conn->write_event);
}
+ if (conn->s >= 0) {
+ log_fn(LOG_INFO,"closing fd %d.",conn->s);
+ tor_close_socket(conn->s);
+ }
+
memset(conn, 0xAA, sizeof(connection_t)); /* poison memory */
tor_free(conn);
}
@@ -309,6 +310,16 @@
conn->s, CONN_TYPE_TO_STRING(conn->type),
conn->state, (int)conn->outbuf_flushlen);
}
+ if (conn->read_event) {
+ event_del(conn->read_event);
+ tor_free(conn->read_event);
+ conn->read_event = NULL;
+ }
+ if (conn->write_event) {
+ event_del(conn->write_event);
+ tor_free(conn->write_event);
+ conn->write_event = NULL;
+ }
tor_close_socket(conn->s);
conn->s = -1;
if (!connection_is_listener(conn)) {