Esempio n. 1
0
File: openssl.c Progetto: 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;
	}
}
Esempio n. 2
0
ssize_t net_send(int fd, const void* buf, size_t len, int flags)
{
	ssize_t ret = send(fd, buf, len, flags);
	if (ret >= 0)
	{
		net_stats_add_tx(ret);
	}
	else
	{
#ifdef WINSOCK
		if (net_error() != WSAEWOULDBLOCK)
#else
		if (net_error() != EWOULDBLOCK)
#endif
		{
			/* net_error_out(fd, "net_send"); */
			net_stats_add_error();
		}
	}
	return ret;
}