summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2010-06-10 10:42:13 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2010-06-10 13:31:18 (GMT)
commitcbe3425a3bd226c61c94f92c521dc5c9b090ef96 (patch)
tree391d6beec4ceb9fab7d5b4a4eb4bc3afd984ebfd /src/network/socket
parent6c8b980a8ea8009a7b80fcce419e331df778a989 (diff)
downloadQt-cbe3425a3bd226c61c94f92c521dc5c9b090ef96.zip
Qt-cbe3425a3bd226c61c94f92c521dc5c9b090ef96.tar.gz
Qt-cbe3425a3bd226c61c94f92c521dc5c9b090ef96.tar.bz2
QLocalServer: make many simultaneous connection attempts work on Windows
Don't call GetOverlappedResult if ConnectNamedPipe connects instantly. Autotest: tst_qlocalsocket::threadedConnection Task-number: QTBUG-8477 Done-with: ossi Reviewed-by: ossi
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qlocalserver_p.h1
-rw-r--r--src/network/socket/qlocalserver_win.cpp6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/network/socket/qlocalserver_p.h b/src/network/socket/qlocalserver_p.h
index feaaae0..4f92b64 100644
--- a/src/network/socket/qlocalserver_p.h
+++ b/src/network/socket/qlocalserver_p.h
@@ -99,6 +99,7 @@ public:
struct Listener {
HANDLE handle;
OVERLAPPED overlapped;
+ bool connected;
};
void setError(const QString &function);
diff --git a/src/network/socket/qlocalserver_win.cpp b/src/network/socket/qlocalserver_win.cpp
index 50d6ca4..940455c 100644
--- a/src/network/socket/qlocalserver_win.cpp
+++ b/src/network/socket/qlocalserver_win.cpp
@@ -85,8 +85,10 @@ bool QLocalServerPrivate::addListener()
if (!ConnectNamedPipe(listener.handle, &listener.overlapped)) {
switch (GetLastError()) {
case ERROR_IO_PENDING:
+ listener.connected = false;
break;
case ERROR_PIPE_CONNECTED:
+ listener.connected = true;
SetEvent(eventHandle);
break;
default:
@@ -155,7 +157,9 @@ void QLocalServerPrivate::_q_onNewConnection()
// a client connection first, so there is no way around polling all of them.
for (int i = 0; i < listeners.size(); ) {
HANDLE handle = listeners[i].handle;
- if (GetOverlappedResult(handle, &listeners[i].overlapped, &dummy, FALSE)) {
+ if (listeners[i].connected
+ || GetOverlappedResult(handle, &listeners[i].overlapped, &dummy, FALSE))
+ {
listeners.removeAt(i);
addListener();