[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] lay a trap for situations where we connection_free something
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] lay a trap for situations where we connection_free something
- From: arma@xxxxxxxx (Roger Dingledine)
- Date: Sun, 30 Jan 2005 19:33:35 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sun, 30 Jan 2005 19:34:00 -0500
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or
Modified Files:
connection.c main.c or.h
Log Message:
lay a trap for situations where we connection_free something
that's still on one of the lists.
in particular, this will detect situations where we mark-for-close
and then free it ourselves.
Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.317
retrieving revision 1.318
diff -u -d -r1.317 -r1.318
--- connection.c 19 Jan 2005 23:15:59 -0000 1.317
+++ connection.c 31 Jan 2005 00:33:32 -0000 1.318
@@ -143,6 +143,8 @@
void connection_free(connection_t *conn) {
tor_assert(conn);
tor_assert(conn->magic == CONNECTION_MAGIC);
+ tor_assert(!connection_in_array(conn));
+ tor_assert(!connection_is_on_closeable_list(conn));
if (!connection_is_listener(conn)) {
buf_free(conn->inbuf);
Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.434
retrieving revision 1.435
diff -u -d -r1.434 -r1.435
--- main.c 31 Jan 2005 00:26:09 -0000 1.434
+++ main.c 31 Jan 2005 00:33:32 -0000 1.435
@@ -206,6 +206,11 @@
smartlist_add(closeable_connection_lst, conn);
}
+/** Return 1 if conn is on the closeable list, else return 0. */
+int connection_is_on_closeable_list(connection_t *conn) {
+ return smartlist_isin(closeable_connection_lst, conn);
+}
+
/** Return true iff conn is in the current poll array. */
int connection_in_array(connection_t *conn) {
int i;
Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.530
retrieving revision 1.531
diff -u -d -r1.530 -r1.531
--- or.h 28 Jan 2005 08:53:47 -0000 1.530
+++ or.h 31 Jan 2005 00:33:32 -0000 1.531
@@ -1393,6 +1393,7 @@
int connection_remove(connection_t *conn);
int connection_in_array(connection_t *conn);
void add_connection_to_closeable_list(connection_t *conn);
+int connection_is_on_closeable_list(connection_t *conn);
void get_connection_array(connection_t ***array, int *n);