path: root/src
diff options
authorAlex Trotsenko <>2015-12-23 13:10:30 +0200
committerAlex Trotsenko <>2015-12-24 14:05:26 +0000
commit6b6955c2ffdb23c461812ffcda12a2296ef58513 (patch)
tree65c09464b1a43d4c25c06e87498bc93b2bcd2c43 /src
parent1e2d35d4880574b20537677729093df279658965 (diff)
QAbstractSocket: do not enable read notifications on TCP in bind()
In bind+connect scenario, rejected connection can trigger a read notification while the socket is opened. But unlike UDP, reading from the socket engine or emitting a readyRead() signal is not allowed for the TCP socket in bound or connecting state. To make a bind+connect scenario work properly, disable the read notifications until a connection is established. Task-number: QTBUG-50124 Change-Id: I7b3d015b0f6021fb9ff9f83560478aa5545f41f5 Reviewed-by: Richard J. Moore <>
Diffstat (limited to 'src')
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 5b1c5fa601..e22c5ccca4 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -1530,7 +1530,8 @@ bool QAbstractSocketPrivate::bind(const QHostAddress &address, quint16 port, QAb
localPort = socketEngine->localPort();
emit q->stateChanged(state);
- socketEngine->setReadNotificationEnabled(true);
+ if (socketType == QAbstractSocket::UdpSocket)
+ socketEngine->setReadNotificationEnabled(true);
return true;