diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/command.c | 7 | ||||
-rw-r--r-- | src/or/nodelist.c | 28 | ||||
-rw-r--r-- | src/or/rephist.c | 6 |
3 files changed, 27 insertions, 14 deletions
diff --git a/src/or/command.c b/src/or/command.c index 46713a5138..3a5c6c01a2 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -273,10 +273,13 @@ command_process_create_cell(cell_t *cell, or_connection_t *conn) "Received CREATE cell (circID %d) for known circ. " "Dropping (age %d).", cell->circ_id, (int)(time(NULL) - conn->_base.timestamp_created)); - if (node) + if (node) { + char *p = esc_for_log(node_get_platform(node)); log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Details: nickname \"%s\", platform %s.", - node_get_nickname(node), escaped(node_get_platform(node))); + node_get_nickname(node), p); + tor_free(p); + } return; } diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 7c036982d5..9518114479 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -656,9 +656,10 @@ node_get_address_string(const node_t *node, char *buf, size_t len) long node_get_declared_uptime(const node_t *node) { - (void)node; - UNIMPLEMENTED_NODELIST(); - return 0; + if (node->ri) + return node->ri->uptime; + else + return -1; } /** Return <b>node</b>'s declared or_port */ @@ -673,22 +674,27 @@ node_get_orport(const node_t *node) return 0; } -/** Return <b>node</b>'s platform string */ +/** Return <b>node</b>'s platform string, or NULL if we don't know it. */ const char * node_get_platform(const node_t *node) { - (void)node; - UNIMPLEMENTED_NODELIST(); - return NULL; + /* If we wanted, we could record the version in the routerstatus_t, since + * the consensus lists it. We don't, though, so this function just won't + * work with microdescriptors. */ + if (node->ri) + return node->ri->platform; + else + return NULL; } -/** Return <b>node</b>'s time of publication. */ +/** Return <b>node</b>'s time of publication, or 0 if we don't have one. */ time_t node_get_published_on(const node_t *node) { - (void)node; - UNIMPLEMENTED_NODELIST(); - return 0; + if (node->ri) + return node->ri->cache_info.published_on; + else + return 0; } /** Return true iff <b>node</b> is one representing this router. */ diff --git a/src/or/rephist.c b/src/or/rephist.c index 97a3c54546..1b978d963d 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -881,8 +881,12 @@ rep_hist_get_router_stability_doc(time_t now) if (node) { char ip[INET_NTOA_BUF_LEN+1]; char tbuf[ISO_TIME_LEN+1]; + time_t published = node_get_published_on(node); node_get_address_string(node,ip,sizeof(ip)); - format_iso_time(tbuf, node_get_published_on(node)); + if (published > 0) + format_iso_time(tbuf, published); + else + strlcpy(tbuf, "???", sizeof(tbuf)); tor_snprintf(header_buf, sizeof(header_buf), "router %s %s %s\n" "published %s\n" |