Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
5.2.1
-
None
Description
When using
connectToHost()
QAbstractSocket::isBuffered gets set correctly. But when one uses
setSocketDescriptor(desc, QAsbtractSocket::ConnectedState, QAbstractSocket::ReadWrite | QAbstractSocket::Unbuffered);
the variable isBuffered doesn't get set.
Thus when calling waitForDisconnected() on an unbuffered QTcpSocket, canReadNotification() calls readFromSocket() and as no data is available, 4096 bytes get allocated. In a scenario where hundreds of sockets are used, this pollutes memory a lot.
The following code in setSocketDescriptor() right before return true; would solve the problem:
d->isBuffered = !(openMode & Unbuffered);