[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Patch: New API for setting/getting socket options in KTcpSocket...
From:       Dawit A <adawit () kde ! org>
Date:       2010-03-26 16:48:00
Message-ID: 201003261248.00550.adawit () kde ! org
[Download RAW message or body]

The attached patch adds functions to set/get socket options to the KTcpSocket 
class. Any objections to adding this to trunk and back porting it to 4.4 
branch ?

FYI: The main purpose behind this API addition is to allow the http ioslaves 
to restore the TCP_NODELAY socket option (disabling Nagle's algorithm) that 
used to exist prior to the Qt 4 port, i.e. in KDE 3.X era.

["ktcpsocket.patch" (text/x-patch)]

Index: kdecore/network/ktcpsocket.cpp
===================================================================
--- kdecore/network/ktcpsocket.cpp	(revision 1107737)
+++ kdecore/network/ktcpsocket.cpp	(working copy)
@@ -759,7 +759,16 @@
     return d->encryptionMode(d->sock.mode());
 }
 
+QVariant KTcpSocket::socketOption(QAbstractSocket::SocketOption options)
+{
+    return d->sock.socketOption(options);
+}
 
+void KTcpSocket::setSocketOption(QAbstractSocket::SocketOption options, const QVariant &value)
+{
+    return d->sock.setSocketOption(options, value);
+}
+
 //slot
 void KTcpSocket::ignoreSslErrors()
 {
Index: kdecore/network/ktcpsocket.h
===================================================================
--- kdecore/network/ktcpsocket.h	(revision 1107737)
+++ kdecore/network/ktcpsocket.h	(working copy)
@@ -307,6 +307,24 @@
 
     EncryptionMode encryptionMode() const;
 
+    /**
+     * Returns the value of the option option.
+     *
+     * @see QAbstractSocket::socketOption
+     *
+     * @since 4.4.2
+     */
+    QVariant socketOption(QAbstractSocket::SocketOption options);
+
+    /**
+     * Sets the given option to the value described by value.
+     *
+     * @see QAbstractSocket::setSocketOption
+     *
+     * @since 4.4.2
+     */
+    void setSocketOption(QAbstractSocket::SocketOption options, const QVariant &value);
+
 Q_SIGNALS:
     //from QAbstractSocket
     void connected();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic