From c17b43e77fd463c9f8dd51bbc2dc1f09c6fb567a Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Wed, 30 Nov 2011 14:54:54 +0100 Subject: [PATCH] Fix bug #144 - Count SSL traffic in !stats. But this does not include the SSL overhead. --- src/network/connection.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/network/connection.c b/src/network/connection.c index a65faa7..6de5f54 100644 --- a/src/network/connection.c +++ b/src/network/connection.c @@ -141,6 +141,10 @@ ssize_t net_con_ssl_handshake(struct net_connection* con, enum net_con_ssl_mode } #endif /* SSL_SUPPORT */ +#ifdef SSL_SUPPORT +void net_stats_add_tx(size_t bytes); +void net_stats_add_rx(size_t bytes); +#endif ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len) { @@ -167,6 +171,10 @@ ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len) { return handle_openssl_error(con, ret); } + else + { + net_stats_add_tx(ret); + } } #endif return ret; @@ -202,6 +210,7 @@ ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len) if (ret > 0) { net_con_update(con, NET_EVENT_READ); + net_stats_add_rx(ret); } else {