diff options
Diffstat (limited to 'src/network/socket/qabstractsocket.cpp')
-rw-r--r-- | src/network/socket/qabstractsocket.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 47fec38283..ac2fb1c34d 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -372,9 +372,22 @@ IP_MULTICAST_LOOP (multicast loopback) socket option. \value TypeOfServiceOption This option is not supported on - Windows. This maps to the IP_TOS socket option. + Windows. This maps to the IP_TOS socket option. For possible values, + see table below. - Possible values for the \e{TypeOfServiceOption} are: + \value SendBufferSizeSocketOption Sets the socket send buffer size + in bytes at the OS level. This maps to the SO_SNDBUF socket option. + This option does not affect the QIODevice or QAbstractSocket buffers. + This enum value has been introduced in Qt 5.3. + + \value ReceiveBufferSizeSocketOption Sets the socket receive + buffer size in bytes at the OS level. + This maps to the SO_RCVBUF socket option. + This option does not affect the QIODevice or QAbstractSocket buffers + (see \l{QAbstractSocket::}{setReadBufferSize()}). + This enum value has been introduced in Qt 5.3. + + Possible values for \e{TypeOfServiceOption} are: \table \header \li Value \li Description @@ -736,8 +749,8 @@ bool QAbstractSocketPrivate::canReadNotification() return true; } - if (!hasData && socketEngine) - socketEngine->setReadNotificationEnabled(true); + if (isBuffered && socketEngine) + socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable()); // reset the read socket notifier state if we reentered inside the // readyRead() connected slot. @@ -1902,6 +1915,14 @@ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, cons case TypeOfServiceOption: d_func()->socketEngine->setOption(QAbstractSocketEngine::TypeOfServiceOption, value.toInt()); break; + + case SendBufferSizeSocketOption: + d_func()->socketEngine->setOption(QAbstractSocketEngine::SendBufferSocketOption, value.toInt()); + break; + + case ReceiveBufferSizeSocketOption: + d_func()->socketEngine->setOption(QAbstractSocketEngine::ReceiveBufferSocketOption, value.toInt()); + break; } } @@ -1936,6 +1957,14 @@ QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option) case TypeOfServiceOption: ret = d_func()->socketEngine->option(QAbstractSocketEngine::TypeOfServiceOption); break; + + case SendBufferSizeSocketOption: + ret = d_func()->socketEngine->option(QAbstractSocketEngine::SendBufferSocketOption); + break; + + case ReceiveBufferSizeSocketOption: + ret = d_func()->socketEngine->option(QAbstractSocketEngine::ReceiveBufferSocketOption); + break; } if (ret == -1) return QVariant(); |