From: Jennifer Richards Date: Thu, 26 Apr 2018 23:33:01 +0000 (-0400) Subject: Don't display "last_connection_attempt" if there is not one X-Git-Tag: 3.4.0~1^2~34^2~5 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=commitdiff_plain;h=77b6d2f32dbcf03d7119170949544966e9b71a9c Don't display "last_connection_attempt" if there is not one --- diff --git a/trp/trp_peer_encoders.c b/trp/trp_peer_encoders.c index 8aafece..b169e17 100644 --- a/trp/trp_peer_encoders.c +++ b/trp/trp_peer_encoders.c @@ -64,15 +64,13 @@ static json_t *last_attempt_to_json_string(TRP_PEER *peer) char *s = NULL; json_t *jstr = NULL; - if (tr_cmp_timespec(trp_peer_get_last_conn_attempt(peer), &ts_zero) == 0) { - s = strdup(""); - } else { + if (tr_cmp_timespec(trp_peer_get_last_conn_attempt(peer), &ts_zero) > 0) { s = timespec_to_str(trp_peer_get_last_conn_attempt(peer)); - } - if (s) { - jstr = json_string(s); - free(s); + if (s) { + jstr = json_string(s); + free(s); + } } return jstr;