Set the socketType and socketProtocol early
The type is known (usually) right after createNewSocket, so let's just set it. They may get overwritten later (in fetchConnectionParameters), but this allows early use of setOption when we need to know the socket type. Change-Id: Iee8cbc07c4434ce9b560ffff13ca09fccb8e1662 Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
parent
3bf4c222e5
commit
dc3dd4f634
@ -425,8 +425,6 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb
|
||||
// setReceiveBufferSize(49152);
|
||||
// setSendBufferSize(49152);
|
||||
|
||||
d->socketType = socketType;
|
||||
d->socketProtocol = protocol;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -259,6 +259,10 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
|
||||
#endif
|
||||
|
||||
socketDescriptor = socket;
|
||||
if (socket != -1) {
|
||||
this->socketProtocol = socketProtocol;
|
||||
this->socketType = socketType;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -442,6 +442,10 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
|
||||
#endif
|
||||
|
||||
socketDescriptor = socket;
|
||||
if (socket != INVALID_SOCKET) {
|
||||
this->socketProtocol = socketProtocol;
|
||||
this->socketType = socketType;
|
||||
}
|
||||
|
||||
// Make the socket nonblocking.
|
||||
if (!setOption(QAbstractSocketEngine::NonBlockingSocketOption, 1)) {
|
||||
|
@ -794,6 +794,8 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
|
||||
return false;
|
||||
}
|
||||
|
||||
this->socketType = socketType;
|
||||
|
||||
// Make the socket nonblocking.
|
||||
if (!setOption(QAbstractSocketEngine::NonBlockingSocketOption, 1)) {
|
||||
setError(QAbstractSocket::UnsupportedSocketOperationError, NonBlockingInitFailedErrorString);
|
||||
|
Loading…
Reference in New Issue
Block a user