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

[tor-commits] [obfsproxy/master] Do not log strerror(errno) in an eventcb unless there was an error.



commit fc7008f4d0c9499ce4435cb29f25ffefa820a1b5
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Feb 13 10:39:02 2012 -0500

    Do not log strerror(errno) in an eventcb unless there was an error.
---
 src/network.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/network.c b/src/network.c
index 3ad859f..a7c1fa6 100644
--- a/src/network.c
+++ b/src/network.c
@@ -858,9 +858,18 @@ flush_error_cb(struct bufferevent *bev, short what, void *arg)
   obfs_assert(conn->circuit);
   obfs_assert(conn->circuit->is_flushing);
 
-  log_warn("Error during flush of connection with %s: %s",
-           safe_str(conn->peername),
-           evutil_socket_error_to_string(errcode));
+  if (what & BEV_EVENT_ERROR) {
+    log_warn("Error during flush of connection with %s: %s",
+             safe_str(conn->peername),
+             evutil_socket_error_to_string(errcode));
+  } else if (what & BEV_EVENT_EOF) {
+    log_info("EOF during flush of connection with %s",
+              safe_str(conn->peername));
+  } else if (what & BEV_EVENT_TIMEOUT) {
+    log_info("EOF during flush of connection with %s",
+             safe_str(conn->peername));
+  }
+
   conn_free(conn);
   return;
 }
@@ -941,7 +950,10 @@ pending_socks_cb(struct bufferevent *bev, short what, void *arg)
      errno isn't meaningful in that case...  */
   if ((what & (BEV_EVENT_EOF|BEV_EVENT_ERROR|BEV_EVENT_TIMEOUT))) {
     int err = EVUTIL_SOCKET_ERROR();
-    log_warn("Connection error: %s", evutil_socket_error_to_string(err));
+    if (what & BEV_EVENT_ERROR)
+      log_warn("Connection error: %s", evutil_socket_error_to_string(err));
+    else
+      log_info("EOF or timeout while waiting for socks");
     if (socks_state_get_status(socks) == ST_HAVE_ADDR) {
       socks_send_reply(socks, bufferevent_get_output(up->buffer), err);
     }

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