Skip to content
This repository
Browse code

Merge pull request #2131 from ulion/tcp_server_badf_reinit

re-init tcp server when encounter EBADF
  • Loading branch information...
commit 70a692d4a46bc6dc8336b81b9e8100607e9ab7fe 2 parents 9edb540 + 72d0824
Memphiz authored January 28, 2013
10  xbmc/network/AirPlayServer.cpp
@@ -253,7 +253,15 @@ void CAirPlayServer::Process()
253 253
         newconnection.m_socket = accept(m_ServerSocket, &newconnection.m_cliaddr, &newconnection.m_addrlen);
254 254
 
255 255
         if (newconnection.m_socket == INVALID_SOCKET)
256  
-          CLog::Log(LOGERROR, "AIRPLAY Server: Accept of new connection failed");
  256
+        {
  257
+          CLog::Log(LOGERROR, "AIRPLAY Server: Accept of new connection failed: %d", errno);
  258
+          if (EBADF == errno)
  259
+          {
  260
+            Sleep(1000);
  261
+            Initialize();
  262
+            break;
  263
+          }
  264
+        }
257 265
         else
258 266
         {
259 267
           CLog::Log(LOGINFO, "AIRPLAY Server: New connection added");
10  xbmc/network/TCPServer.cpp
@@ -182,7 +182,15 @@ void CTCPServer::Process()
182 182
           newconnection->m_socket = accept(*it, (sockaddr*)&newconnection->m_cliaddr, &newconnection->m_addrlen);
183 183
 
184 184
           if (newconnection->m_socket == INVALID_SOCKET)
185  
-            CLog::Log(LOGERROR, "JSONRPC Server: Accept of new connection failed");
  185
+          {
  186
+            CLog::Log(LOGERROR, "JSONRPC Server: Accept of new connection failed: %d", errno);
  187
+            if (EBADF == errno)
  188
+            {
  189
+              Sleep(1000);
  190
+              Initialize();
  191
+              break;
  192
+            }
  193
+          }
186 194
           else
187 195
           {
188 196
             CLog::Log(LOGINFO, "JSONRPC Server: New connection added");

0 notes on commit 70a692d

Please sign in to comment.
Something went wrong with that request. Please try again.