QAbstractSocket: remove unnecessary checks

There is no need to check the 'enabled' states before calling
set{Read|Write}NotificationEnabled() functions, because the socket
event notifiers are fully optimized for this case.

Change-Id: I0cd4fbc2298c9b9523420a60a46a65e0b305fa12
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Alex Trotsenko 2016-03-09 15:29:55 +02:00
parent feca9d95c1
commit 8042c5243c

View File

@ -871,8 +871,7 @@ bool QAbstractSocketPrivate::writeToSocket()
}
}
if (writeBuffer.isEmpty() && socketEngine && socketEngine->isWriteNotificationEnabled()
&& !socketEngine->bytesToWrite())
if (writeBuffer.isEmpty() && socketEngine && !socketEngine->bytesToWrite())
socketEngine->setWriteNotificationEnabled(false);
if (state == QAbstractSocket::ClosingState)
q->disconnectFromHost();
@ -2420,7 +2419,7 @@ qint64 QAbstractSocket::readData(char *data, qint64 maxSize)
d->setError(d->socketEngine->error(), d->socketEngine->errorString());
d->resetSocketLayer();
d->state = QAbstractSocket::UnconnectedState;
} else if (!d->socketEngine->isReadNotificationEnabled()) {
} else {
// Only do this when there was no error
d->socketEngine->setReadNotificationEnabled(true);
}