Skip to content

Commit

Permalink
Merge pull request #2131 from ulion/tcp_server_badf_reinit
Browse files Browse the repository at this point in the history
re-init tcp server when encounter EBADF
  • Loading branch information
Memphiz committed Jan 28, 2013
2 parents 9edb540 + 72d0824 commit 70a692d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion xbmc/network/AirPlayServer.cpp
Expand Up @@ -253,7 +253,15 @@ void CAirPlayServer::Process()
newconnection.m_socket = accept(m_ServerSocket, &newconnection.m_cliaddr, &newconnection.m_addrlen);

if (newconnection.m_socket == INVALID_SOCKET)
CLog::Log(LOGERROR, "AIRPLAY Server: Accept of new connection failed");
{
CLog::Log(LOGERROR, "AIRPLAY Server: Accept of new connection failed: %d", errno);
if (EBADF == errno)
{
Sleep(1000);
Initialize();
break;
}
}
else
{
CLog::Log(LOGINFO, "AIRPLAY Server: New connection added");
Expand Down
10 changes: 9 additions & 1 deletion xbmc/network/TCPServer.cpp
Expand Up @@ -182,7 +182,15 @@ void CTCPServer::Process()
newconnection->m_socket = accept(*it, (sockaddr*)&newconnection->m_cliaddr, &newconnection->m_addrlen);

if (newconnection->m_socket == INVALID_SOCKET)
CLog::Log(LOGERROR, "JSONRPC Server: Accept of new connection failed");
{
CLog::Log(LOGERROR, "JSONRPC Server: Accept of new connection failed: %d", errno);
if (EBADF == errno)
{
Sleep(1000);
Initialize();
break;
}
}
else
{
CLog::Log(LOGINFO, "JSONRPC Server: New connection added");
Expand Down

0 comments on commit 70a692d

Please sign in to comment.