diff options
author | schwaers | 2015-04-30 16:47:58 +0200 |
---|---|---|
committer | schwaers | 2015-04-30 16:47:58 +0200 |
commit | 642b59ca0364b9dd74ad5efa1975462140f0a7ba (patch) | |
tree | 52149ac7d9207007367f2b66e0a08182e021e5b6 /src/server/net.c | |
parent | [SERVER] Added counters for received and sent bytes. (diff) | |
download | dnbd3-642b59ca0364b9dd74ad5efa1975462140f0a7ba.tar.gz dnbd3-642b59ca0364b9dd74ad5efa1975462140f0a7ba.tar.xz dnbd3-642b59ca0364b9dd74ad5efa1975462140f0a7ba.zip |
[SERVER] PoC RPC interface
Diffstat (limited to 'src/server/net.c')
-rw-r--r-- | src/server/net.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/server/net.c b/src/server/net.c index 9836043..2edb398 100644 --- a/src/server/net.c +++ b/src/server/net.c @@ -43,6 +43,8 @@ #include "../config.h" #include "../types.h" #include "locks.h" +#include "rpc.h" + static uint64_t totalBytesSent = 0; static pthread_spinlock_t statisticsSentLock; @@ -66,8 +68,7 @@ static inline bool recv_request_header(int sock, dnbd3_request_t *request) } // Payload sanity check if ( request->cmd != CMD_GET_BLOCK && request->size > MAX_PAYLOAD ) { - logadd( LOG_WARNING, "Client tries to send a packet of type %d with %d bytes payload. Dropping client.", (int)request->cmd, - (int)request->size ); + logadd( LOG_WARNING, "Client tries to send a packet of type %d with %d bytes payload. Dropping client.", (int)request->cmd, (int)request->size ); return false; } return true; @@ -187,6 +188,9 @@ 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 ) { |