Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

re-init tcp server when encounter EBADF #2131

Merged
merged 1 commit into from

2 participants

@ulion
Collaborator

on ios, if you lock screen for a while, then re-open, may encounter the EBADF erron of tcp listen socket accept() call and will dead loop forever with ECONNABORTED errno after the first EBADF error.

this commit fix this and make the tcp-server reinit when EBADF errno catched.

@Memphiz
Owner

Ok its there on linux and android too - you can remove the ifdef - its save for our platforms. After that i hit the green button.

@ulion
Collaborator

changed back.
although it passed on other platform, I still didn't consider other platforms, your consideration is necessary and thanks.

@Memphiz Memphiz merged commit 70a692d into xbmc:master
@Memphiz
Owner

Thx ulion :)

@ulion
Collaborator

this problem may existed since eden, lock screen for a while and reopen will active it, cost cpu and generate large log (which is at error level).

@ulion ulion deleted the ulion:tcp_server_badf_reinit branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 28, 2013
  1. @ulion
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 2 deletions.
  1. +9 −1 xbmc/network/AirPlayServer.cpp
  2. +9 −1 xbmc/network/TCPServer.cpp
View
10 xbmc/network/AirPlayServer.cpp
@@ -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");
View
10 xbmc/network/TCPServer.cpp
@@ -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");
Something went wrong with that request. Please try again.