summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qsocks5socketengine.cpp
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2009-07-22 07:59:54 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2009-07-23 10:18:38 (GMT)
commitd6a01d0f948361ac5cacab0bf9f8585041485259 (patch)
treef17bc439920c2f366be9528cf41bc45e69209fc3 /src/network/socket/qsocks5socketengine.cpp
parent9377881d6d6f5c07aa134c8f1708d0afd0d06e86 (diff)
downloadQt-d6a01d0f948361ac5cacab0bf9f8585041485259.zip
Qt-d6a01d0f948361ac5cacab0bf9f8585041485259.tar.gz
Qt-d6a01d0f948361ac5cacab0bf9f8585041485259.tar.bz2
Sockets: Added support for SO_KEEPALIVE and TCP_NODELAY
Introduce QAbstractSocket::setSocketOption that allows to set the socket options for TCP Keep Alive and TCP_NODELAY (disabling Nagle's Algorithm). Reviewed-by: Thiago
Diffstat (limited to 'src/network/socket/qsocks5socketengine.cpp')
-rw-r--r--src/network/socket/qsocks5socketengine.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index c9e5150..d226f21 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -1621,14 +1621,28 @@ qint64 QSocks5SocketEngine::pendingDatagramSize() const
int QSocks5SocketEngine::option(SocketOption option) const
{
- Q_UNUSED(option);
+ Q_D(const QSocks5SocketEngine);
+ if (d->data && d->data->controlSocket) {
+ // convert the enum and call the real socket
+ if (option == QAbstractSocketEngine::LowDelayOption)
+ return d->data->controlSocket->socketOption(QAbstractSocket::LowDelayOption).toInt();
+ if (option == QAbstractSocketEngine::KeepAliveOption)
+ return d->data->controlSocket->socketOption(QAbstractSocket::KeepAliveOption).toInt();
+ }
return -1;
}
bool QSocks5SocketEngine::setOption(SocketOption option, int value)
{
- Q_UNUSED(option);
- Q_UNUSED(value);
+ Q_D(QSocks5SocketEngine);
+ if (d->data && d->data->controlSocket) {
+ // convert the enum and call the real socket
+ if (option == QAbstractSocketEngine::LowDelayOption)
+ d->data->controlSocket->setSocketOption(QAbstractSocket::LowDelayOption, value);
+ if (option == QAbstractSocketEngine::KeepAliveOption)
+ d->data->controlSocket->setSocketOption(QAbstractSocket::KeepAliveOption, value);
+ return true;
+ }
return false;
}