diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/tortls.c | 11 | ||||
-rw-r--r-- | src/common/tortls.h | 4 | ||||
-rw-r--r-- | src/or/main.c | 12 |
3 files changed, 27 insertions, 0 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c index 07cf17bc1..33666166b 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -1346,3 +1346,14 @@ tor_tls_used_v1_handshake(tor_tls_t *tls) return 1; } +/** DOCDOC */ +void +tor_tls_get_buffer_sizes(tor_tls_t *tls, + int *rbuf_capacity, int *rbuf_bytes, + int *wbuf_capacity, int *wbuf_bytes) +{ + *rbuf_capacity = tls->ssl->s3->rbuf.len; + *wbuf_capacity = tls->ssl->s3->wbuf.len; + *rbuf_bytes = tls->ssl->s3->rbuf.left; + *wbuf_bytes = tls->ssl->s3->wbuf.left; +} diff --git a/src/common/tortls.h b/src/common/tortls.h index 52c8350fe..211c8255b 100644 --- a/src/common/tortls.h +++ b/src/common/tortls.h @@ -73,6 +73,10 @@ size_t tor_tls_get_forced_write_size(tor_tls_t *tls); void tor_tls_get_n_raw_bytes(tor_tls_t *tls, size_t *n_read, size_t *n_written); +void tor_tls_get_buffer_sizes(tor_tls_t *tls, + int *rbuf_capacity, int *rbuf_bytes, + int *wbuf_capacity, int *wbuf_bytes); + int tor_tls_used_v1_handshake(tor_tls_t *tls); /* Log and abort if there are unhandled TLS errors in OpenSSL's error stack. diff --git a/src/or/main.c b/src/or/main.c index 36c87df8d..55803ae15 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1611,6 +1611,7 @@ dumpstats(int severity) { time_t now = time(NULL); time_t elapsed; + int rbuf_cap, wbuf_cap, rbuf_len, wbuf_len; log(severity, LD_GENERAL, "Dumping stats:"); @@ -1638,6 +1639,17 @@ dumpstats(int severity) (int)buf_datalen(conn->outbuf), (int)buf_allocation(conn->outbuf), (int)(now - conn->timestamp_lastwritten)); + if (conn->type == CONN_TYPE_OR) { + or_connection_t *or_conn = TO_OR_CONN(conn); + if (or_conn->tls) { + tor_tls_get_buffer_sizes(or_conn->tls, &rbuf_cap, &rbuf_len, + &wbuf_cap, &wbuf_len); + log(severity, LD_GENERAL, + "Conn %d: %d/%d bytes used on openssl read buffer; " + "%d/%d bytes used on write buffer.", + i, rbuf_len, rbuf_cap, wbuf_len, wbuf_cap); + } + } } circuit_dump_by_conn(conn, severity); /* dump info about all the circuits * using this conn */ |