[Jsonrpc-cpp-devel] Patch to fix socket leak in TCP Server
Brought to you by:
s-vincent
From: Markus G. <ma...@ga...> - 2014-07-13 05:49:25
|
Hi, I'm using jsonrpc-cpp-0.4 and found a major bug. After some time my applicaiton (using TcpServer) stopped working with 100% CPU load. I found out that it used many many file descriptors due to not closing the client sockets. The fix is rather simple: --- src/jsonrpc_tcpserver.cpp.orig 2014-07-13 07:39:55.237060802 +0200 +++ src/jsonrpc_tcpserver.cpp 2014-07-13 06:17:27.462943211 +0200 @@ -185,6 +185,7 @@ /* remove disconnect socket descriptor */ for(std::list<int>::iterator it = m_purge.begin() ; it != m_purge.end() ; it++) { + ::close((*it)); m_clients.remove((*it)); } thanks, Markus |