summaryrefslogtreecommitdiffstats
path: root/src/server/net.c
diff options
context:
space:
mode:
authorStephan Schwaer2015-05-05 18:18:32 +0200
committerStephan Schwaer2015-05-05 18:18:32 +0200
commitd3ee0d21a16b6e696297b8e1f0c4ad8abdecca37 (patch)
treeb823abbb74ff769e30507560b125495a413fe90b /src/server/net.c
parentRemoved dnbd3_printClients, added clients to statistics json in rpc. (diff)
downloaddnbd3-d3ee0d21a16b6e696297b8e1f0c4ad8abdecca37.tar.gz
dnbd3-d3ee0d21a16b6e696297b8e1f0c4ad8abdecca37.tar.xz
dnbd3-d3ee0d21a16b6e696297b8e1f0c4ad8abdecca37.zip
[Server] Added statistics of images and uptime to json.
Diffstat (limited to 'src/server/net.c')
-rw-r--r--src/server/net.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/server/net.c b/src/server/net.c
index dc53701..9dc1442 100644
--- a/src/server/net.c
+++ b/src/server/net.c
@@ -124,14 +124,6 @@ uint64_t net_getTotalBytesSent()
return tmp;
}
-void net_addTotalBytesSent(uint64_t sentBytes)
-{
- spin_lock( &statisticsSentLock );
- totalBytesSent += sentBytes;
- spin_unlock( &statisticsSentLock );
- return;
-}
-
void net_init()
{
spin_init( &statisticsSentLock, PTHREAD_PROCESS_PRIVATE );
@@ -206,7 +198,6 @@ void *net_client_handler(void *dnbd3_client)
}
} else if ( strncmp( (char*)&request, "GET ", 4 ) == 0 || strncmp( (char*)&request, "POST ", 5 ) == 0 ) {
rpc_sendStatsJson( client->sock );
- logadd( LOG_INFO, "Sending statistics." );
}
if ( bOk ) {
@@ -388,7 +379,9 @@ set_name: ;
}
exit_client_cleanup: ;
dnbd3_removeClient( client );
- net_addTotalBytesSent( client->bytesSent ); // Add the amount of bytes sent by the client to the statistics of the server.
+ spin_lock( &statisticsSentLock );
+ totalBytesSent += client->bytesSent;// Add the amount of bytes sent by the client to the statistics of the server.
+ spin_unlock( &statisticsSentLock );
client = dnbd3_freeClient( client );
return NULL ;
}