[tor-commits] [tor/master] Log response size in connection_dir_client_reached_eof()

nickm at torproject.org nickm at torproject.org
Mon Feb 27 15:58:47 UTC 2017


commit 56bbaed0dc61190e730178d1d5a7f0cc10625bdd
Author: Alexander Færøy <ahf at torproject.org>
Date:   Tue Feb 7 14:34:49 2017 +0000

    Log response size in connection_dir_client_reached_eof()
    
    This patch ensures that we log the size of the inbuf when a directory
    client have reached EOF on the connection.
    
    See: https://bugs.torproject.org/21206
---
 src/or/directory.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/or/directory.c b/src/or/directory.c
index 3881adb..36714bc 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1954,6 +1954,9 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
                        conn->base_.purpose == DIR_PURPOSE_FETCH_MICRODESC);
   time_t now = time(NULL);
   int src_code;
+  size_t received_bytes;
+
+  received_bytes = connection_get_inbuf_len(TO_CONN(conn));
 
   switch (connection_fetch_from_buf_http(TO_CONN(conn),
                               &headers, MAX_HEADERS_SIZE,
@@ -1982,10 +1985,13 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
 
   log_debug(LD_DIR,
             "Received response from directory server '%s:%d': %d %s "
-            "(purpose: %d)",
+            "(purpose: %d, response size: " U64_FORMAT ", "
+            "compression: %d)",
             conn->base_.address, conn->base_.port, status_code,
             escaped(reason),
-            conn->base_.purpose);
+            conn->base_.purpose,
+            U64_PRINTF_ARG(received_bytes),
+            compression);
 
   if (conn->guard_state) {
     /* we count the connection as successful once we can read from it.  We do





More information about the tor-commits mailing list