[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [obfsproxy/master] Do not log errno unless BEV_EVENT_ERROR is set: it was confusing



commit 9fe5f1c79b0161a6aecfa3dc7c80204fe9ddfee1
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Sun Feb 12 22:02:38 2012 -0500

    Do not log errno unless BEV_EVENT_ERROR is set: it was confusing
---
 src/network.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/network.c b/src/network.c
index bcd5be9..3ad859f 100644
--- a/src/network.c
+++ b/src/network.c
@@ -816,8 +816,14 @@ error_cb(struct bufferevent *bev, short what, void *arg)
 {
   conn_t *conn = arg;
   int errcode = EVUTIL_SOCKET_ERROR();
-  log_debug("%s for %s: what=0x%04x errno=%d", __func__, safe_str(conn->peername),
-            what, errcode);
+  if (what & BEV_EVENT_ERROR) {
+    log_debug("%s for %s: what=0x%04x errno=%d", __func__,
+              safe_str(conn->peername),
+              what, errcode);
+  } else {
+    log_debug("%s for %s: what=0x%04x", __func__,
+              safe_str(conn->peername), what);
+  }
 
   /* It should be impossible to get here with BEV_EVENT_CONNECTED. */
   obfs_assert(!(what & BEV_EVENT_CONNECTED));

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits