Guys,
I am using quickfix on FreeBSD 8.1 and saw an issue where the select()
system call on a socket that has
been closed with close() before does not return with a value < 0. This
happens, whenever a thread context
switch happens between the close() and select().
This is probably a bug in FreeBSD and I will address that in the
appropriate mailing list.
Nevertheless I have written and attached a small patch for quickfix that
fixes this behaviour as I am not
sure if one can rely on the return value of select() for all OS'es.
Cheers,
Heri
--- ThreadedSocketConnection.cpp.orig 2011-03-16 15:06:42.000000000 +0100
+++ ThreadedSocketConnection.cpp 2011-03-16 15:08:01.000000000 +0100
@@ -85,6 +85,11 @@
try
{
+ // workaround if we find that select on closed sockets does
+ // not return < 0. happens e.g. on FreeBSD 8.1-RELEASE
+ if( m_disconnect )
+ return false;
+
// Wait for input (1 second timeout)
int result = select( 1 + m_socket, &readset, 0, 0, &timeout );
|