summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-06-17 15:10:51 +0000
committerNick Mathewson <nickm@torproject.org>2007-06-17 15:10:51 +0000
commitd828915136af1aac50b94a4567584b3745b13f8a (patch)
tree427e0fd7b9047de6e991f6d6e3b3024c6b102bef /src
parentc9c9bdfc1d3e043a67ce926b1d576ca8320426c8 (diff)
downloadtor-d828915136af1aac50b94a4567584b3745b13f8a.tar.gz
tor-d828915136af1aac50b94a4567584b3745b13f8a.zip
r13463@catbus: nickm | 2007-06-17 11:10:17 -0400
Add a SOURCE_ADDR field to STREAM NEW events so that controllers can match requests to applications. (Patch from Robert Hogan.) svn:r10639
Diffstat (limited to 'src')
-rw-r--r--src/or/control.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 2683be1987..0fc859ca17 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -425,7 +425,7 @@ get_escaped_string(const char *start, size_t in_len_max,
* but it will always end with a CRLF sequence.
*
* Currently the length of the message is limited to 1024 (including the
- * ending \n\r\0. */
+ * ending \r\n\0. */
static void
connection_printf_to_buf(control_connection_t *conn, const char *format, ...)
{
@@ -2636,6 +2636,7 @@ control_event_stream_status(edge_connection_t *conn, stream_status_event_t tp,
int reason_code)
{
char reason_buf[64];
+ char addrport_buf[64];
const char *status;
circuit_t *circ;
origin_circuit_t *origin_circ = NULL;
@@ -2698,15 +2699,25 @@ control_event_stream_status(edge_connection_t *conn, stream_status_event_t tp,
break;
}
}
+
+ if (tp == STREAM_EVENT_NEW) {
+ tor_snprintf(addrport_buf,sizeof(addrport_buf), "%sSOURCE_ADDR=%s:%d",
+ strlen(reason_buf) ? " " : "",
+ TO_CONN(conn)->address, TO_CONN(conn)->port );
+ } else {
+ addrport_buf[0] = '\0';
+ }
+
circ = circuit_get_by_edge_conn(conn);
if (circ && CIRCUIT_IS_ORIGIN(circ))
origin_circ = TO_ORIGIN_CIRCUIT(circ);
send_control_event_extended(EVENT_STREAM_STATUS, ALL_NAMES,
- "650 STREAM %lu %s %lu %s@%s\r\n",
+ "650 STREAM %lu %s %lu %s@%s%s\r\n",
(unsigned long)conn->global_identifier, status,
origin_circ?
(unsigned long)origin_circ->global_identifier : 0ul,
- buf, reason_buf);
+ buf, reason_buf, addrport_buf);
+
/* XXX need to specify its intended exit, etc? */
return 0;