diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-11-23 00:08:26 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-11-23 00:08:26 +0000 |
commit | cd702643770fb17c00a67f8f5154e6852acb5e1c (patch) | |
tree | 234e4dad86a8c9e60d82479dbd815187f9eaaa0b /src/common | |
parent | 6fc834ab16936530166aa087d9469048c65b1697 (diff) | |
download | tor-cd702643770fb17c00a67f8f5154e6852acb5e1c.tar.gz tor-cd702643770fb17c00a67f8f5154e6852acb5e1c.zip |
Clean up some logging and interfaces
svn:r2945
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/tortls.c | 5 | ||||
-rw-r--r-- | src/common/util.c | 8 |
2 files changed, 3 insertions, 10 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c index 578c093ebe..d930f46422 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -441,12 +441,13 @@ tor_tls_read(tor_tls *tls, char *cp, size_t len) if (r > 0) return r; err = tor_tls_get_error(tls, r, CATCH_ZERO, "reading", LOG_INFO); - log_fn(LOG_DEBUG,"returned r=%d, err=%d",r,err); if (err == _TOR_TLS_ZERORETURN) { + log_fn(LOG_DEBUG,"read returned r=%d; TLS is closed",r); tls->state = TOR_TLS_ST_CLOSED; return TOR_TLS_CLOSE; } else { tor_assert(err != TOR_TLS_DONE); + log_fn(LOG_DEBUG,"read returned r=%d, err=%d",r,err); return err; } } @@ -479,7 +480,6 @@ tor_tls_write(tor_tls *tls, char *cp, size_t n) return r; } if (err == TOR_TLS_WANTWRITE || err == TOR_TLS_WANTREAD) { -// log_fn(LOG_INFO,"wantwrite or wantread. remembering the number %d.",n); tls->wantwrite_n = n; } return err; @@ -685,7 +685,6 @@ tor_tls_verify(tor_tls *tls, crypto_pk_env_t **identity_key) if (!(chain = SSL_get_peer_cert_chain(tls->ssl))) goto done; num_in_chain = sk_X509_num(chain); - log_fn(LOG_DEBUG,"Number of certs in chain: %d", num_in_chain); /* 1 means we're receiving (server-side), and it's just the id_cert. * 2 means we're connecting (client-side), and it's both the link * cert and the id_cert. diff --git a/src/common/util.c b/src/common/util.c index 3099b125cc..f2386cde4b 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -475,7 +475,6 @@ int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen) * ===== */ /** Return the number of microseconds elapsed between *start and *end. - * If start is after end, return 0. */ long tv_udiff(struct timeval *start, struct timeval *end) @@ -483,17 +482,12 @@ tv_udiff(struct timeval *start, struct timeval *end) long udiff; long secdiff = end->tv_sec - start->tv_sec; - if (secdiff+1 > LONG_MAX/1000000) { + if (labs(secdiff+1) > LONG_MAX/1000000) { log_fn(LOG_WARN, "comparing times too far apart."); return LONG_MAX; } udiff = secdiff*1000000L + (end->tv_usec - start->tv_usec); - if(udiff < 0) { - log_fn(LOG_INFO, "start (%ld.%ld) is after end (%ld.%ld). Returning 0.", - (long)start->tv_sec, (long)start->tv_usec, (long)end->tv_sec, (long)end->tv_usec); - return 0; - } return udiff; } |