Fix bug #144 - Count SSL traffic in !stats. But this does not include the SSL overhead.

This commit is contained in:
Jan Vidar Krey 2011-11-30 14:54:54 +01:00
parent 675e6af3ba
commit c17b43e77f

View File

@ -141,6 +141,10 @@ ssize_t net_con_ssl_handshake(struct net_connection* con, enum net_con_ssl_mode
} }
#endif /* SSL_SUPPORT */ #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) 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); return handle_openssl_error(con, ret);
} }
else
{
net_stats_add_tx(ret);
}
} }
#endif #endif
return ret; return ret;
@ -202,6 +210,7 @@ ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len)
if (ret > 0) if (ret > 0)
{ {
net_con_update(con, NET_EVENT_READ); net_con_update(con, NET_EVENT_READ);
net_stats_add_rx(ret);
} }
else else
{ {