From 2860f3393025e114f11feb1b576d2ac6353fbd23 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 8 Aug 2018 12:09:14 +0200 Subject: [SERVER] Use atomic var for (total)bytesSent counters Gets rid of the lastBytesSent field as well as the stats lock per client. Cleaned and split up the messy net_clientsToJson function while at it. --- src/server/uplink.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/server/uplink.c') diff --git a/src/server/uplink.c b/src/server/uplink.c index da63d82..879d08c 100644 --- a/src/server/uplink.c +++ b/src/server/uplink.c @@ -802,12 +802,10 @@ static void uplink_handleReceive(dnbd3_connection_t *link) bytesSent = (size_t)sent - sizeof outReply; } } - spin_lock( &client->statsLock ); pthread_mutex_unlock( &client->sendMutex ); if ( bytesSent != 0 ) { client->bytesSent += bytesSent; } - spin_unlock( &client->statsLock ); spin_lock( &link->queueLock ); } if ( req->status == ULR_FREE && i == link->queueLen - 1 ) link->queueLen--; -- cgit v1.2.3-55-g7522