[Live-devel] Overuse of CPU in binaries of CYGWIN

Warren Young warren at etr-usa.com
Wed Feb 26 16:12:19 PST 2014


On 2/25/2014 14:33, Ross Finlayson wrote:
>
> The "RTSPClientConnection" object gets deleted if the call to
> "readSocket()" in
> "RTSPServer::RTSPClientConnection::incomingRequestHandler1()" (line 786
> of "RTSPServer.cpp) returns a value < 0 - which should happen when the
> remote (i.e., client) end of the TCP connection gets closed

The FreeBSD recv() page says that, but it's incomplete.  It only 
documents > 0 and -1 returns, but there is also the possibility of a 0 
return, which is a legal, distinct value.  It mans the client has done a 
graceful disconnect.

The recv() pages for Linux and Winsock fully document this behavior:

	http://goo.gl/zi6cGZ
	http://linux.die.net/man/2/recv

I have verified that FreeBSD 9 behaves the same way.  With a simple 
select() based server, select() says the socket is readable after the 
client gracefully disconnects, and the subsequent recv() call does get 
0, not -1.

I imagine if you continue calling recv() on that socket, some stacks may 
then return -1 (errno == ENOTCONN?) but that's because the error is in 
the caller, because it is calling recv() more times than necessary.

I sent an email to this list on November 25 with a potential similar 
problem in Groupsock.


More information about the live-devel mailing list