Example #1
0
File: openssl.c Project: Tilka/uhub
static void add_io_stats(struct net_ssl_openssl* handle)
{
	if (handle->bio->num_read > handle->bytes_rx)
	{
		net_stats_add_rx(handle->bio->num_read - handle->bytes_rx);
		handle->bytes_rx = handle->bio->num_read;
	}

	if (handle->bio->num_write > handle->bytes_tx)
	{
		net_stats_add_tx(handle->bio->num_write - handle->bytes_tx);
		handle->bytes_tx = handle->bio->num_write;
	}
}
Example #2
0
ssize_t net_recv(int fd, void* buf, size_t len, int flags)
{
	ssize_t ret = recv(fd, buf, len, flags);
	if (ret >= 0)
	{
		net_stats_add_rx(ret);
	}
	else
	{
#ifdef WINSOCK
		if (net_error() != WSAEWOULDBLOCK)
#else
		if (net_error() != EWOULDBLOCK)
#endif
		{
			/* net_error_out(fd, "net_recv"); */
			net_stats_add_error();
		}
	}
	return ret;
}