Ticket #1583: 0001-Remove-the-extra-space-that-is-sent-in-certain-STREA.patch

File 0001-Remove-the-extra-space-that-is-sent-in-certain-STREA.patch, 2.9 KB (added by katmagic, 10 years ago)

patch

  • src/or/control.c

    From dcf9c4b9354adcfb6698480756187d629992c5b7 Mon Sep 17 00:00:00 2001
    From: Kat Magic <kat.magic@zalau.ro>
    Date: Tue, 22 Jun 2010 19:04:56 -0400
    Subject: [PATCH] Remove the extra space that is sent in certain STREAM messages from the
     controller. (closes #1583)
    
    ---
     src/or/control.c |   17 ++++++++---------
     1 files changed, 8 insertions(+), 9 deletions(-)
    
    diff --git a/src/or/control.c b/src/or/control.c
    index 5797edf..61aaed4 100644
    a b control_event_stream_status(edge_connection_t *conn, stream_status_event_t tp, 
    30583058    char *r = NULL;
    30593059    if (!reason_str) {
    30603060      r = tor_malloc(16);
    3061       tor_snprintf(r, 16, "UNKNOWN_%d", reason_code);
     3061      tor_snprintf(r, 16, " UNKNOWN_%d", reason_code);
    30623062      reason_str = r;
    30633063    }
    30643064    if (reason_code & END_STREAM_REASON_FLAG_REMOTE)
    30653065      tor_snprintf(reason_buf, sizeof(reason_buf),
    3066                    "REASON=END REMOTE_REASON=%s", reason_str);
     3066                   " REASON=END REMOTE_REASON=%s", reason_str);
    30673067    else
    30683068      tor_snprintf(reason_buf, sizeof(reason_buf),
    3069                    "REASON=%s", reason_str);
     3069                   " REASON=%s", reason_str);
    30703070    tor_free(r);
    30713071  } else if (reason_code && tp == STREAM_EVENT_REMAP) {
    30723072    switch (reason_code) {
    30733073    case REMAP_STREAM_SOURCE_CACHE:
    3074       strlcpy(reason_buf, "SOURCE=CACHE", sizeof(reason_buf));
     3074      strlcpy(reason_buf, " SOURCE=CACHE", sizeof(reason_buf));
    30753075      break;
    30763076    case REMAP_STREAM_SOURCE_EXIT:
    3077       strlcpy(reason_buf, "SOURCE=EXIT", sizeof(reason_buf));
     3077      strlcpy(reason_buf, " SOURCE=EXIT", sizeof(reason_buf));
    30783078      break;
    30793079    default:
    3080       tor_snprintf(reason_buf, sizeof(reason_buf), "REASON=UNKNOWN_%d",
     3080      tor_snprintf(reason_buf, sizeof(reason_buf), " REASON=UNKNOWN_%d",
    30813081                   reason_code);
    30823082      /* XXX do we want SOURCE=UNKNOWN_%d above instead? -RD */
    30833083      break;
    control_event_stream_status(edge_connection_t *conn, stream_status_event_t tp, 
    30853085  }
    30863086
    30873087  if (tp == STREAM_EVENT_NEW) {
    3088     tor_snprintf(addrport_buf,sizeof(addrport_buf), "%sSOURCE_ADDR=%s:%d",
    3089                  strlen(reason_buf) ? " " : "",
     3088    tor_snprintf(addrport_buf,sizeof(addrport_buf), " SOURCE_ADDR=%s:%d",
    30903089                 TO_CONN(conn)->address, TO_CONN(conn)->port );
    30913090  } else {
    30923091    addrport_buf[0] = '\0';
    control_event_stream_status(edge_connection_t *conn, stream_status_event_t tp, 
    31163115  if (circ && CIRCUIT_IS_ORIGIN(circ))
    31173116    origin_circ = TO_ORIGIN_CIRCUIT(circ);
    31183117  send_control_event(EVENT_STREAM_STATUS, ALL_FORMATS,
    3119                         "650 STREAM "U64_FORMAT" %s %lu %s %s%s%s\r\n",
     3118                        "650 STREAM "U64_FORMAT" %s %lu %s%s%s%s\r\n",
    31203119                        U64_PRINTF_ARG(conn->_base.global_identifier), status,
    31213120                        origin_circ?
    31223121                           (unsigned long)origin_circ->global_identifier : 0ul,