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>
This commit is contained in:
Alex Trotsenko 2015-04-13 20:21:16 +03:00
parent 1e01be433d
commit 3610513450
2 changed files with 9 additions and 0 deletions

View File

@ -650,6 +650,8 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
return false;
}
configureCreatedSocket();
if (threadData->hasEventDispatcher())
socketEngine->setReceiver(this);
@ -660,6 +662,12 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
return true;
}
/*! \internal
*/
void QAbstractSocketPrivate::configureCreatedSocket()
{
}
/*! \internal
Slot connected to the read socket notifier. This slot is called

View File

@ -130,6 +130,7 @@ public:
bool flush();
bool initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol);
virtual void configureCreatedSocket();
void startConnectingByName(const QString &host);
void fetchConnectionParameters();
void setupSocketNotifiers();