summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-04-12 17:06:17 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-04-12 17:55:54 (GMT)
commit9af8b63fd730bf29179a08ee53dc99b7e7646bda (patch)
treea447230d77a8772693403adbdf53ff89101977ed
parent0aa780235c24ed724fcf6a9095a6467e34b9346e (diff)
downloadQt-9af8b63fd730bf29179a08ee53dc99b7e7646bda.zip
Qt-9af8b63fd730bf29179a08ee53dc99b7e7646bda.tar.gz
Qt-9af8b63fd730bf29179a08ee53dc99b7e7646bda.tar.bz2
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
-rw-r--r--src/network/socket/qsocks5socketengine.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index c365635..88b5aca 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -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) {