Fix error handling in write for socks socket engine

When socks socket engine calls the write function of the native socket
engine, it now propagates errors to the abstract socket.

Task-number: QTBUG-18713
Reviewed-by: Markus Goetz
This commit is contained in:
Shane Kearns 2011-04-12 18:06:17 +01:00 committed by Markus Goetz
parent 3a76f74e88
commit 279883fdf1

View File

@ -1540,8 +1540,13 @@ qint64 QSocks5SocketEngine::write(const char *data, qint64 len)
// ### Handle this error.
}
d->data->controlSocket->write(sealedBuf);
qint64 written = d->data->controlSocket->write(sealedBuf);
if (written <= 0) {
QSOCKS5_Q_DEBUG << "native write returned" << written;
return written;
}
d->data->controlSocket->waitForBytesWritten(0);
//NB: returning len rather than written for the OK case, because the "sealing" may increase the length
return len;
#ifndef QT_NO_UDPSOCKET
} else if (d->mode == QSocks5SocketEnginePrivate::UdpAssociateMode) {