Skip to content

Commit

Permalink
HPCC-19323 Poll() to handle EINTR consistently
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Kelly <mark.kelly@lexisnexisrisk.com>
  • Loading branch information
mckellyln committed Mar 16, 2018
1 parent a4372d5 commit 8bf7e44
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions system/jlib/jsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,12 @@ bool CSocket::connect_timeout( unsigned timeout, bool noexception)
else if (rc<0)
{
err = ERRNO();
LOGERR2(err,2,"::select/poll");
if (err != JSE_INTR)
{
LOGERR2(err,2,"::select/poll");
errclose();
break;
}
}
}
if (err==0)
Expand Down Expand Up @@ -1413,8 +1418,11 @@ void CSocket::connect_wait(unsigned timems)
if (rc<0)
{
err = ERRNO();
LOGERR2(err,2,"::select/poll");
break;
if (err != JSE_INTR)
{
LOGERR2(err,2,"::select/poll");
break;
}
}
if (!timeoutms)
{
Expand Down Expand Up @@ -3957,6 +3965,12 @@ class CSocketBaseThread: public Thread
return true;
}
}
else
{
int err = ERRNO();
if (err == JSE_INTR)
return true; // assume ok until next time called
}
StringBuffer sockstr;
const char *tracename = sockstr.append((unsigned)sock).str();
LOGERR2(ERRNO(),3,"CSocketBaseThread poll handle");
Expand Down Expand Up @@ -6428,7 +6442,15 @@ class CSocketConnectWait: implements ISocketConnectWait, public CInterface
else
{ // select/poll failed
err = ERRNO();
LOGERR(err,2,"CSocketConnectWait ::select/poll");
if (err != JSE_INTR)
{
LOGERR(err,2,"CSocketConnectWait ::select/poll");
sock->errclose();
isopen = false;
if (!oneshot)
connectimedout = true; // to force same behavior as before
break;
}
}
}
if (err==0)
Expand Down

0 comments on commit 8bf7e44

Please sign in to comment.