// update the central counter after every 1MB (8ms
// at gigabit speeds, should be enough) of sent data
// update the central counter after every 1MB (8ms
// at gigabit speeds, should be enough) of sent data
pthread_mutex_lock(&send_mutex);
total_bytes_sent += bytes_sent;
pthread_mutex_unlock(&send_mutex);
pthread_mutex_lock(&send_mutex);
total_bytes_sent += bytes_sent;
pthread_mutex_unlock(&send_mutex);
// update the central counter after every 1MB (8ms
// at gigabit speeds, should be enough) of received data
// update the central counter after every 1MB (8ms
// at gigabit speeds, should be enough) of received data
pthread_mutex_lock(&receive_mutex);
total_bytes_received += bytes_received;
pthread_mutex_unlock(&receive_mutex);
pthread_mutex_lock(&receive_mutex);
total_bytes_received += bytes_received;
pthread_mutex_unlock(&receive_mutex);