Browse Source

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
Alexander Færøy 7 years ago
parent
commit
56bbaed0dc
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/or/directory.c

+ 8 - 2
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