From 761439cc8d2ce88cdcde68fed0140ea9320777c6 Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Sun, 5 Aug 2012 08:20:31 +0200 Subject: [PATCH] Setting socket pair non-blocking --- indra/llmessage/aicurlthread.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/indra/llmessage/aicurlthread.cpp b/indra/llmessage/aicurlthread.cpp index 98116398f..5d9b04e5e 100644 --- a/indra/llmessage/aicurlthread.cpp +++ b/indra/llmessage/aicurlthread.cpp @@ -911,12 +911,22 @@ void AICurlThread::create_wakeup_fds(void) if (dumb_socketpair(socks, false) == SOCKET_ERROR) { llerrs << "Failed to generate wake-up socket pair" << formatWSAError() << llendl; + return; } - else - { - mWakeUpFd = socks[0]; - mWakeUpFd_in = socks[1]; - } + u_long nonblocking_enable = TRUE; + int error = ioctlsocket(socks[0], FIONBIO, &nonblocking_enable); + if(error) + { + llerrs << "Failed to set wake-up socket nonblocking: " << formatWSAError() << llendl; + } + llassert(nonblocking_enable); + error = ioctlsocket(socks[1], FIONBIO, &nonblocking_enable); + if(error) + { + llerrs << "Failed to set wake-up input socket nonblocking: " << formatWSAError() << llendl; + } + mWakeUpFd = socks[0]; + mWakeUpFd_in = socks[1]; #else int pipefd[2]; if (pipe(pipefd))