Fixed a problem in Linux handling of ListenThread.
A closed socket doesn't seem to wake up a select() call on that socket on Linux. Fixed by waking up by a timeout regularly (semi-busywait). Fixes FS #334 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1305 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
561f105394
commit
a4e6a027a1
@ -205,7 +205,10 @@ void cListenThread::Execute(void)
|
||||
FD_SET(itr->GetSocket(), &fdRead);
|
||||
} // for itr - m_Sockets[]
|
||||
|
||||
if (select(Highest + 1, &fdRead, NULL, NULL, NULL) == -1)
|
||||
timeval tv; // On Linux select() doesn't seem to wake up when socket is closed, so let's kinda busy-wait:
|
||||
tv.tv_sec = 1;
|
||||
tv.tv_usec = 0;
|
||||
if (select(Highest + 1, &fdRead, NULL, NULL, &tv) == -1)
|
||||
{
|
||||
LOG("select(R) call failed in cListenThread: \"%s\"", cSocket::GetLastErrorString().c_str());
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user