Ticket #7708: handle_write.patch

File handle_write.patch, 1.2 KB (added by nickm, 7 years ago)
  • src/or/connection.

    old new  
    32193219
    32203220  if (connection_speaks_cells(conn) &&
    32213221      conn->state > OR_CONN_STATE_PROXY_HANDSHAKING) {
     3222    size_t initial_size;
    32223223    or_connection_t *or_conn = TO_OR_CONN(conn);
    32233224    if (conn->state == OR_CONN_STATE_TLS_HANDSHAKING ||
    32243225        conn->state == OR_CONN_STATE_TLS_CLIENT_RENEGOTIATING) {
     
    32343235      return connection_handle_read(conn);
    32353236    }
    32363237
     3238    initial_size = buf_datalen(conn->outbuf);
    32373239    /* else open, or closing */
    32383240    result = flush_buf_tls(or_conn->tls, conn->outbuf,
    32393241                           max_to_write, &conn->outbuf_flushlen);
     
    32573259      case TOR_TLS_WANTWRITE:
    32583260        log_debug(LD_NET,"wanted write.");
    32593261        /* we're already writing */
    3260         return 0;
     3262        break;
    32613263      case TOR_TLS_WANTREAD:
    32623264        /* Make sure to avoid a loop if the receive buckets are empty. */
    32633265        log_debug(LD_NET,"wanted read.");
     
    32763278       */
    32773279    }
    32783280
     3281    result = (int)(initial_size-buf_datalen(conn->outbuf));
    32793282    tor_tls_get_n_raw_bytes(or_conn->tls, &n_read, &n_written);
    32803283    log_debug(LD_GENERAL, "After TLS write of %d: %ld read, %ld written",
    32813284              result, (long)n_read, (long)n_written);