|
@@ -3108,6 +3108,7 @@ control_event_stream_status(edge_connection_t *conn, stream_status_event_t tp,
|
|
|
circuit_t *circ;
|
|
|
origin_circuit_t *origin_circ = NULL;
|
|
|
char buf[256];
|
|
|
+ const char *purpose = "";
|
|
|
tor_assert(conn->socks_request);
|
|
|
|
|
|
if (!EVENT_IS_INTERESTING(EVENT_STREAM_STATUS))
|
|
@@ -3175,15 +3176,35 @@ control_event_stream_status(edge_connection_t *conn, stream_status_event_t tp,
|
|
|
addrport_buf[0] = '\0';
|
|
|
}
|
|
|
|
|
|
+ if (tp == STREAM_EVENT_NEW_RESOLVE) {
|
|
|
+ purpose = " PURPOSE=DNS_REQUEST";
|
|
|
+ } else if (tp == STREAM_EVENT_NEW) {
|
|
|
+ if (conn->is_dns_request ||
|
|
|
+ (conn->socks_request &&
|
|
|
+ SOCKS_COMMAND_IS_RESOLVE(conn->socks_request->command)))
|
|
|
+ purpose = " PURPOSE=DNS_REQUEST";
|
|
|
+ else if (conn->use_begindir) {
|
|
|
+ connection_t *linked = TO_CONN(conn)->linked_conn;
|
|
|
+ int linked_dir_purpose = -1;
|
|
|
+ if (linked && linked->type == CONN_TYPE_DIR)
|
|
|
+ linked_dir_purpose = linked->purpose;
|
|
|
+ if (DIR_PURPOSE_IS_UPLOAD(linked_dir_purpose))
|
|
|
+ purpose = " PURPOSE=DIR_UPLOAD";
|
|
|
+ else
|
|
|
+ purpose = " PURPOSE=DIR_FETCH";
|
|
|
+ } else
|
|
|
+ purpose = " PURPOSE=USER";
|
|
|
+ }
|
|
|
+
|
|
|
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%s\r\n",
|
|
|
+ "650 STREAM %lu %s %lu %s@%s%s%s\r\n",
|
|
|
(unsigned long)conn->global_identifier, status,
|
|
|
origin_circ?
|
|
|
(unsigned long)origin_circ->global_identifier : 0ul,
|
|
|
- buf, reason_buf, addrport_buf);
|
|
|
+ buf, reason_buf, addrport_buf, purpose);
|
|
|
|
|
|
/* XXX need to specify its intended exit, etc? */
|
|
|
|