mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-24 14:45:53 +00:00
If we hit EINTR in a blocking recv/send, retry instead of failing
* blocking send/recv will not be resumed after a signal handler no matter what, so we need to retry ourselves. This does mean extending the timeout but that's fine since it would be pathological to have EINTR continually arrive and extend the timeout to an unreasonable duration.
This commit is contained in:
@@ -167,7 +167,13 @@ bool Socket::SendDataBlocking(const void *buf, uint32_t length)
|
||||
{
|
||||
int err = errno;
|
||||
|
||||
if(err == EWOULDBLOCK || err == EAGAIN || err == EINTR)
|
||||
if(err == EINTR)
|
||||
{
|
||||
// if we hit EINTR, just try again completely. Technically this restarts the timeout but we
|
||||
// expect EINTR to be rare so it's not a big deal.
|
||||
continue;
|
||||
}
|
||||
else if(err == EWOULDBLOCK || err == EAGAIN)
|
||||
{
|
||||
RDCWARN("Timeout in send");
|
||||
Shutdown();
|
||||
@@ -293,7 +299,13 @@ bool Socket::RecvDataBlocking(void *buf, uint32_t length)
|
||||
{
|
||||
int err = errno;
|
||||
|
||||
if(err == EWOULDBLOCK || err == EAGAIN || err == EINTR)
|
||||
if(err == EINTR)
|
||||
{
|
||||
// if we hit EINTR, just try again completely. Technically this restarts the timeout but we
|
||||
// expect EINTR to be rare so it's not a big deal.
|
||||
continue;
|
||||
}
|
||||
else if(err == EWOULDBLOCK || err == EAGAIN)
|
||||
{
|
||||
RDCWARN("Timeout in recv");
|
||||
Shutdown();
|
||||
|
||||
Reference in New Issue
Block a user