Commit 42e17182 authored by Nick Mathewson's avatar Nick Mathewson 🐘
Browse files

When we get an EOF or a timeout on a directory connection, note how many bytes...

When we get an EOF or a timeout on a directory connection, note how many bytes of serverdesc we are dropping. This will help us determine whether it is smart to parse incomplete serverdesc responses.


svn:r5186
parent 61ea5168
Loading
Loading
Loading
Loading
+1 −1
Changes for doc/TODO: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ N . Routerdesc download changes
      o Networkstatus should list who's an authority.
      o Add nickname element to dirserver line.  Log this along with IP:Port.
      o Warn when using non-default directory servers.
      - When giving up on a non-finished dir request, log how many bytes
      o When giving up on a non-finished dir request, log how many bytes
        dropped, to see whether it's worthwhile to use partial info.
    - Security
      - Alices avoid duplicate class C nodes.
+6 −0
Changes for src/or/directory.c: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1111,6 +1111,12 @@ connection_dir_reached_eof(connection_t *conn)
  int retval;
  if (conn->state != DIR_CONN_STATE_CLIENT_READING) {
    log_fn(LOG_INFO,"conn reached eof, not reading. Closing.");
    /* This check is temporary; it's to let us know whether we should consider
     * parsing partial serverdesc responses. */
    if (conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC) {
      log_fn(LOG_NOTICE, "Reached EOF while downloading server descriptors; dropping %d bytes.",
             buf_datalen(conn->inbuf));
    }
    connection_close_immediate(conn); /* it was an error; give up on flushing */
    connection_mark_for_close(conn);
    return -1;
+6 −0
Changes for src/or/main.c: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -575,6 +575,12 @@ run_connection_housekeeping(int i, time_t now)
      conn->timestamp_lastwritten + 5*60 < now) {
    log_fn(LOG_INFO,"Expiring wedged directory conn (fd %d, purpose %d)",
           conn->s, conn->purpose);
    /* This check is temporary; it's to let us know whether we should consider
     * parsing partial serverdesc responses. */
    if (conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC) {
      log_fn(LOG_NOTICE, "Expired wedged directory conn was downloading server descriptors; dropping %d bytes.",
             buf_datalen(conn->inbuf));
    }
    connection_mark_for_close(conn);
    return;
  }