From 499eeced4493b2012c1ba449ad2a960498dce00f Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Mon, 13 Mar 2006 19:33:46 +0000 Subject: [PATCH] when event_add or event_del fail, tell us why. svn:r6156 --- src/or/main.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/or/main.c b/src/or/main.c index 775e0798ba..0fe663b193 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -319,8 +319,9 @@ connection_stop_reading(connection_t *conn) log_debug(LD_NET,"connection_stop_reading() called."); if (event_del(conn->read_event)) log_warn(LD_NET, "Error from libevent setting read event state for %d " - "to unwatched.", - conn->s); + "to unwatched: %s", + conn->s, + tor_socket_strerror(tor_socket_errno(conn->s))); } /** Tell the main loop to start notifying conn of any read events. */ @@ -332,8 +333,9 @@ connection_start_reading(connection_t *conn) if (event_add(conn->read_event, NULL)) log_warn(LD_NET, "Error from libevent setting read event state for %d " - "to watched.", - conn->s); + "to watched: %s", + conn->s, + tor_socket_strerror(tor_socket_errno(conn->s))); } /** Return true iff conn is listening for write events. */ @@ -354,9 +356,9 @@ connection_stop_writing(connection_t *conn) if (event_del(conn->write_event)) log_warn(LD_NET, "Error from libevent setting write event state for %d " - "to unwatched.", - conn->s); - + "to unwatched: %s", + conn->s, + tor_socket_strerror(tor_socket_errno(conn->s))); } /** Tell the main loop to start notifying conn of any write events. */ @@ -368,8 +370,9 @@ connection_start_writing(connection_t *conn) if (event_add(conn->write_event, NULL)) log_warn(LD_NET, "Error from libevent setting write event state for %d " - "to watched.", - conn->s); + "to watched: %s", + conn->s, + tor_socket_strerror(tor_socket_errno(conn->s))); } /** Close all connections that have been scheduled to get closed */