summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2015-04-13 20:21:16 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2015-04-13 20:23:31 +0000
commit361051345047a76da15ddc3de71a21b672944837 (patch)
tree911111e26e59c96f12d77deabba82b724ea59502 /src/network
parent1e01be433dfbeb15df0bed28fcf100b82151b86b (diff)
QAbstractSocket: virtualize options setting
Some kinds of socket options can be applied only to newly created descriptors. However, a current QAbstractSocket implementation proceeds to actions immediately after the socket layer initialization. This disallows a socket tuning in further inheritance. Add a private virtual configureCreatedSocket() method that gives an ability to set the socket options before binding or connecting. Change-Id: I2d858a400cd46ae7fe5bf0b8900220f6121d0132 Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/socket/qabstractsocket.cpp8
-rw-r--r--src/network/socket/qabstractsocket_p.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index baecf27162..67dea74436 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -650,6 +650,8 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
return false;
}
+ configureCreatedSocket();
+
if (threadData->hasEventDispatcher())
socketEngine->setReceiver(this);
@@ -661,6 +663,12 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
}
/*! \internal
+*/
+void QAbstractSocketPrivate::configureCreatedSocket()
+{
+}
+
+/*! \internal
Slot connected to the read socket notifier. This slot is called
when new data is available for reading, or when the socket has
diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h
index 63440b6416..1c04277f49 100644
--- a/src/network/socket/qabstractsocket_p.h
+++ b/src/network/socket/qabstractsocket_p.h
@@ -130,6 +130,7 @@ public:
bool flush();
bool initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol);
+ virtual void configureCreatedSocket();
void startConnectingByName(const QString &host);
void fetchConnectionParameters();
void setupSocketNotifiers();