aboutsummaryrefslogtreecommitdiffstats
path: root/src/websockets/qwebsocket_p.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 16:00:36 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 16:00:36 +0200
commit7d09b6961496f6cc33668ef494d0b58f75004fcb (patch)
tree1998d1c2a0d905c6457d26f385fc919be766aa42 /src/websockets/qwebsocket_p.cpp
parent658509543361fc698c1a2720219baabaa3ba59d5 (diff)
parente1a8b7723a373ecb8837e8bf8249a03a1208d193 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into tqtc/lts-5.15-opensourcev5.15.9-lts-lgpl
Diffstat (limited to 'src/websockets/qwebsocket_p.cpp')
-rw-r--r--src/websockets/qwebsocket_p.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index 824184a..cf3087f 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -429,8 +429,10 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask)
QSslSocket *sslSocket = new QSslSocket(q);
m_pSocket = sslSocket;
if (Q_LIKELY(m_pSocket)) {
- m_pSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
- m_pSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
+ QObject::connect(sslSocket, &QSslSocket::connected, [sslSocket](){
+ sslSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
+ sslSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
+ });
m_pSocket->setReadBufferSize(m_readBufferSize);
m_pSocket->setPauseMode(m_pauseMode);
@@ -458,8 +460,10 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask)
if (url.scheme() == QStringLiteral("ws")) {
m_pSocket = new QTcpSocket(q);
if (Q_LIKELY(m_pSocket)) {
- m_pSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
- m_pSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
+ QObject::connect(m_pSocket, &QTcpSocket::connected, [this](){
+ m_pSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
+ m_pSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
+ });
m_pSocket->setReadBufferSize(m_readBufferSize);
m_pSocket->setPauseMode(m_pauseMode);