diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2015-12-24 00:15:44 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2015-12-30 20:14:19 +0000 |
commit | cbc4750f52964e6e7e13e296e526de98ef538cd4 (patch) | |
tree | 3b2dc3f664f623f445f58915993eed38c7db4ac9 /src/network/socket | |
parent | a6b2a4642f07cd6e52b447e1e441b257990a8d03 (diff) |
QSocks5SocketEngine: Always try to connect in connectToHost unless already connecting.
Otherwise, connectInternal becomes a no-op after an initial connection attempt
has been made (making the socket effectively useless if that connection attempt
fails).
A workaround is to close() the socket, which worked by virtue of
QAbstractSocket's close() disconnecting (which ultimately calls
resetSocketLayer, and destroys the socket engine instance) - meaning that the
next connection attempt would have a fresh socks instance to try out the
connection with.
Reported-by: Gabe Edwards <gabe.edwards@me.com>
Change-Id: Iab1e84af6d4248fd75a6dfe5e79a3c73129aae0b
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network/socket')
-rw-r--r-- | src/network/socket/qsocks5socketengine.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 26543883cc..6868e8c73a 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1111,14 +1111,16 @@ bool QSocks5SocketEngine::connectInternal() } } - if (d->socks5State == QSocks5SocketEnginePrivate::Uninitialized - && d->socketState != QAbstractSocket::ConnectingState) { - setState(QAbstractSocket::ConnectingState); - //limit buffer in internal socket, data is buffered in the external socket under application control - d->data->controlSocket->setReadBufferSize(65536); + if (d->socketState != QAbstractSocket::ConnectingState) { + if (d->socks5State == QSocks5SocketEnginePrivate::Uninitialized) { + setState(QAbstractSocket::ConnectingState); + //limit buffer in internal socket, data is buffered in the external socket under application control + d->data->controlSocket->setReadBufferSize(65536); + } + d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port()); - return false; } + return false; } |