summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
authorAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-10-02 10:00:11 (GMT)
committerAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-10-02 10:07:53 (GMT)
commitb0b8d8f7a65e31c0edabe7fbe6ee91bb62a67d7c (patch)
tree003ee8c075ecc41fb60c6fbf52e0867aa653993b /src/network/socket
parentd119d83503ade36a450c0326d94764dc9da18dab (diff)
downloadQt-b0b8d8f7a65e31c0edabe7fbe6ee91bb62a67d7c.zip
Qt-b0b8d8f7a65e31c0edabe7fbe6ee91bb62a67d7c.tar.gz
Qt-b0b8d8f7a65e31c0edabe7fbe6ee91bb62a67d7c.tar.bz2
Dealing with socket that was signalized on exception fds set
It turns out that if socket was signalized via exception fds set, we should signalize only write notifier in the case where both read and write notifiers exist. If in this case we send signal to read notification socket will prematurely be closed. x#Reviewed-by: Janne Antilla
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 2bf9858..f890d12 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -1018,10 +1018,12 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c
if(selectForExec) {
qWarning("nativeSelect (checkRead %d, checkWrite %d, ret %d, errno %d): Unexpected expectfds ready in fd %d",
checkRead, checkWrite, ret, errno, socketDescriptor);
- if (checkRead)
- FD_SET(socketDescriptor, &fdread);
- if (checkWrite)
+ if (checkWrite){
+ FD_CLR(socketDescriptor, &fdread);
FD_SET(socketDescriptor, &fdwrite);
+ } else if (checkRead)
+ FD_SET(socketDescriptor, &fdread);
+
if ((ret == -1) && ( errno == ECONNREFUSED || errno == EPIPE ))
ret = 1;