summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qabstractsocket.cpp13
-rw-r--r--src/network/socket/qhttpsocketengine.cpp2
-rw-r--r--src/network/socket/qlocalsocket.cpp41
-rw-r--r--src/network/socket/qlocalsocket.h11
-rw-r--r--src/network/socket/qlocalsocket_p.h4
-rw-r--r--src/network/socket/qlocalsocket_tcp.cpp23
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp41
-rw-r--r--src/network/socket/qlocalsocket_win.cpp13
-rw-r--r--src/network/socket/qsocks5socketengine.cpp4
-rw-r--r--src/network/socket/qtcpserver.cpp4
10 files changed, 67 insertions, 89 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index b8957ce818..3d88c0337d 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -464,7 +464,10 @@
#include "qabstractsocket_p.h"
#include "private/qhostinfo_p.h"
+#if QT_CONFIG(bearermanagement) // ### Qt6: Remove section
#include "private/qnetworksession_p.h"
+#endif
+#include "private/qnetworkconfiguration_p.h" // ### Qt6: Remove include
#include <qabstracteventdispatcher.h>
#include <qhostaddress.h>
@@ -643,7 +646,7 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
QAbstractSocket::tr("Operation on socket is not supported"));
return false;
}
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket engine (if it has been set)
socketEngine->setProperty("_q_networksession", q->property("_q_networksession"));
#endif
@@ -1146,7 +1149,7 @@ void QAbstractSocketPrivate::_q_connectToNextAddress()
Qt::DirectConnection);
}
int connectTimeout = QNetworkConfigurationPrivate::DefaultTimeout;
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> networkSession = qvariant_cast< QSharedPointer<QNetworkSession> >(q->property("_q_networksession"));
if (networkSession) {
QNetworkConfiguration networkConfiguration = networkSession->configuration();
@@ -1941,7 +1944,7 @@ bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState
d->setError(UnsupportedSocketOperationError, tr("Operation on socket is not supported"));
return false;
}
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket engine (if it has been set)
d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
#endif
@@ -2134,7 +2137,7 @@ bool QAbstractSocket::waitForConnected(int msecs)
QElapsedTimer stopWatch;
stopWatch.start();
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> networkSession = qvariant_cast< QSharedPointer<QNetworkSession> >(property("_q_networksession"));
#endif
@@ -2157,7 +2160,7 @@ bool QAbstractSocket::waitForConnected(int msecs)
return false; // connect not im progress anymore!
int connectTimeout = QNetworkConfigurationPrivate::DefaultTimeout;
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
if (networkSession) {
QNetworkConfiguration networkConfiguration = networkSession->configuration();
connectTimeout = networkConfiguration.connectTimeout();
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 98f850ba1b..b80bdec992 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -72,7 +72,7 @@ bool QHttpSocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSo
setSocketType(type);
d->socket = new QTcpSocket(this);
d->reply = new QHttpNetworkReply(QUrl(), this);
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
d->socket->setProperty("_q_networkSession", property("_q_networkSession"));
#endif
diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp
index d517f91aad..38e47d6e26 100644
--- a/src/network/socket/qlocalsocket.cpp
+++ b/src/network/socket/qlocalsocket.cpp
@@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE
The socket is opened in the given \a openMode and first enters ConnectingState.
If a connection is established, QLocalSocket enters ConnectedState and emits connected().
- After calling this function, the socket can emit error() to signal that an error occurred.
+ After calling this function, the socket can emit errorOccurred() to signal that an error occurred.
\sa state(), serverName(), waitForConnected()
*/
@@ -87,7 +87,7 @@ QT_BEGIN_NAMESPACE
Note that unlike in most other QIODevice subclasses, open() may not open the device directly.
The function return false if the socket was already connected or if the server to connect
- to was not defined and true in any other case. The connected() or error() signals will be
+ to was not defined and true in any other case. The connected() or errorOccurred() signals will be
emitted once the device is actualy open (or the connection failed).
See connectToServer() for more details.
@@ -220,25 +220,11 @@ QT_BEGIN_NAMESPACE
/*!
\fn QLocalSocket::LocalSocketError QLocalSocket::error() const
- \deprecated
-
- Use socketError() instead.
-
- Returns the type of error that last occurred.
-
- \sa state(), errorString(), socketError()
-*/
-
-/*!
- \fn QLocalSocket::LocalSocketError QLocalSocket::socketError() const
- \since 5.15
-
Returns the type of error that last occurred.
\sa state(), errorString()
*/
-
/*!
\fn bool QLocalSocket::isValid() const
@@ -286,7 +272,7 @@ QT_BEGIN_NAMESPACE
Waits until the socket is connected, up to \a msecs milliseconds. If the
connection has been established, this function returns \c true; otherwise
it returns \c false. In the case where it returns \c false, you can call
- socketError() to determine the cause of the error.
+ error() to determine the cause of the error.
The following example waits up to one second for a connection
to be established:
@@ -305,7 +291,7 @@ QT_BEGIN_NAMESPACE
connection was successfully disconnected, this function returns \c true;
otherwise it returns \c false (if the operation timed out, if an error
occurred, or if this QLocalSocket is already disconnected). In the case
- where it returns \c false, you can call socketError() to determine the cause of
+ where it returns \c false, you can call error() to determine the cause of
the error.
The following example waits up to one second for a connection
@@ -343,6 +329,14 @@ QT_BEGIN_NAMESPACE
/*!
\fn void QLocalSocket::error(QLocalSocket::LocalSocketError socketError)
+ \obsolete
+
+ Use errorOccurred() instead.
+*/
+
+/*!
+ \fn void QLocalSocket::errorOccurred(QLocalSocket::LocalSocketError socketError)
+ \since 5.15
This signal is emitted after an error occurred. The \a socketError
parameter describes the type of error that occurred.
@@ -351,7 +345,7 @@ QT_BEGIN_NAMESPACE
connections, you will have to register it with Q_DECLARE_METATYPE() and
qRegisterMetaType().
- \sa socketError(), errorString(), {Creating Custom Qt Types}
+ \sa error(), errorString(), {Creating Custom Qt Types}
*/
/*!
@@ -376,6 +370,9 @@ QLocalSocket::QLocalSocket(QObject * parent)
{
Q_D(QLocalSocket);
d->init();
+
+ // Support the deprecated error() signal:
+ connect(this, &QLocalSocket::errorOccurred, this, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error));
}
/*!
@@ -403,7 +400,7 @@ bool QLocalSocket::open(OpenMode openMode)
The socket is opened in the given \a openMode and first enters ConnectingState.
If a connection is established, QLocalSocket enters ConnectedState and emits connected().
- After calling this function, the socket can emit error() to signal that an error occurred.
+ After calling this function, the socket can emit errorOccurred() to signal that an error occurred.
\sa state(), serverName(), waitForConnected()
*/
@@ -460,7 +457,7 @@ QString QLocalSocket::fullServerName() const
/*!
Returns the state of the socket.
- \sa socketError()
+ \sa error()
*/
QLocalSocket::LocalSocketState QLocalSocket::state() const
{
@@ -480,7 +477,7 @@ bool QLocalSocket::isSequential() const
The LocalServerError enumeration represents the errors that can occur.
The most recent error can be retrieved through a call to
- \l QLocalSocket::socketError().
+ \l QLocalSocket::error().
\value ConnectionRefusedError The connection was refused by
the peer (or timed out).
diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h
index 9cf76d1022..ae78c86b3c 100644
--- a/src/network/socket/qlocalsocket.h
+++ b/src/network/socket/qlocalsocket.h
@@ -97,12 +97,7 @@ public:
virtual bool canReadLine() const override;
virtual bool open(OpenMode openMode = ReadWrite) override;
virtual void close() override;
-
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_X("Use socketError()") LocalSocketError error() const;
-#endif // QT_DEPRECATED_SINCE(5, 15)
-
- LocalSocketError socketError() const;
+ LocalSocketError error() const;
bool flush();
bool isValid() const;
qint64 readBufferSize() const;
@@ -122,7 +117,11 @@ public:
Q_SIGNALS:
void connected();
void disconnected();
+#if QT_DEPRECATED_SINCE(5,15)
+ QT_DEPRECATED_X("Use QLocalSocket::errorOccurred(QLocalSocket::LocalSocketError) instead")
void error(QLocalSocket::LocalSocketError socketError);
+#endif
+ void errorOccurred(QLocalSocket::LocalSocketError socketError);
void stateChanged(QLocalSocket::LocalSocketState socketState);
protected:
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index d93b53be0c..e3bcd92326 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -125,7 +125,7 @@ public:
bool ownsTcpSocket;
void setSocket(QLocalUnixSocket*);
QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const;
- void errorOccurred(QLocalSocket::LocalSocketError, const QString &function);
+ void setErrorAndEmit(QLocalSocket::LocalSocketError, const QString &function);
void _q_stateChanged(QAbstractSocket::SocketState newState);
void _q_error(QAbstractSocket::SocketError newError);
#elif defined(Q_OS_WIN)
@@ -142,7 +142,7 @@ public:
qint64 skip(qint64 maxSize) override;
QLocalUnixSocket unixSocket;
QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const;
- void errorOccurred(QLocalSocket::LocalSocketError, const QString &function);
+ void setErrorAndEmit(QLocalSocket::LocalSocketError, const QString &function);
void _q_stateChanged(QAbstractSocket::SocketState newState);
void _q_error(QAbstractSocket::SocketError newError);
void _q_connectToSocket();
diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp
index 74d3d547b9..e13bcfc0cb 100644
--- a/src/network/socket/qlocalsocket_tcp.cpp
+++ b/src/network/socket/qlocalsocket_tcp.cpp
@@ -95,7 +95,7 @@ void QLocalSocketPrivate::_q_error(QAbstractSocket::SocketError socketError)
QLocalSocket::LocalSocketError error = (QLocalSocket::LocalSocketError)socketError;
QString errorString = generateErrorString(error, function);
q->setErrorString(errorString);
- emit q->error(error);
+ emit q->errorOccurred(error);
}
void QLocalSocketPrivate::_q_stateChanged(QAbstractSocket::SocketState newState)
@@ -168,7 +168,7 @@ QString QLocalSocketPrivate::generateErrorString(QLocalSocket::LocalSocketError
return errorString;
}
-void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, const QString &function)
+void QLocalSocketPrivate::setErrorAndEmit(QLocalSocket::LocalSocketError error, const QString &function)
{
Q_Q(QLocalSocket);
switch (error) {
@@ -206,7 +206,7 @@ void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, co
QString errorString = generateErrorString(error, function);
q->setErrorString(errorString);
- emit q->error(error);
+ emit q->errorOccurred(error);
// errors cause a disconnect
tcpSocket->setSocketState(QAbstractSocket::UnconnectedState);
@@ -222,7 +222,7 @@ void QLocalSocket::connectToServer(OpenMode openMode)
Q_D(QLocalSocket);
if (state() == ConnectedState || state() == ConnectingState) {
setErrorString(tr("Trying to connect while connection is in progress"));
- emit error(QLocalSocket::OperationError);
+ emit errorOccurred(QLocalSocket::OperationError);
return;
}
@@ -231,8 +231,8 @@ void QLocalSocket::connectToServer(OpenMode openMode)
emit stateChanged(d->state);
if (d->serverName.isEmpty()) {
- d->errorOccurred(ServerNotFoundError,
- QLatin1String("QLocalSocket::connectToServer"));
+ d->setErrorAndEmit(ServerNotFoundError,
+ QLatin1String("QLocalSocket::connectToServer"));
return;
}
@@ -246,8 +246,8 @@ void QLocalSocket::connectToServer(OpenMode openMode)
bool ok;
const quint16 port = settings.value(d->fullServerName).toUInt(&ok);
if (!ok) {
- d->errorOccurred(ServerNotFoundError,
- QLatin1String("QLocalSocket::connectToServer"));
+ d->setErrorAndEmit(ServerNotFoundError,
+ QLatin1String("QLocalSocket::connectToServer"));
return;
}
QIODevice::open(openMode);
@@ -363,15 +363,8 @@ void QLocalSocket::disconnectFromServer()
d->tcpSocket->disconnectFromHost();
}
-#if QT_DEPRECATED_SINCE(5, 15)
QLocalSocket::LocalSocketError QLocalSocket::error() const
{
- return socketError();
-}
-#endif // QT_DEPRECATED_SINCE(5, 15)
-
-QLocalSocket::LocalSocketError QLocalSocket::socketError() const
-{
Q_D(const QLocalSocket);
switch (d->tcpSocket->error()) {
case QAbstractSocket::ConnectionRefusedError:
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index 2e2eb7dee9..e860b880d5 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -99,7 +99,7 @@ void QLocalSocketPrivate::_q_error(QAbstractSocket::SocketError socketError)
QLocalSocket::LocalSocketError error = (QLocalSocket::LocalSocketError)socketError;
QString errorString = generateErrorString(error, function);
q->setErrorString(errorString);
- emit q->error(error);
+ emit q->errorOccurred(error);
}
void QLocalSocketPrivate::_q_stateChanged(QAbstractSocket::SocketState newState)
@@ -172,7 +172,7 @@ QString QLocalSocketPrivate::generateErrorString(QLocalSocket::LocalSocketError
return errorString;
}
-void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, const QString &function)
+void QLocalSocketPrivate::setErrorAndEmit(QLocalSocket::LocalSocketError error, const QString &function)
{
Q_Q(QLocalSocket);
switch (error) {
@@ -210,7 +210,7 @@ void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, co
QString errorString = generateErrorString(error, function);
q->setErrorString(errorString);
- emit q->error(error);
+ emit q->errorOccurred(error);
// errors cause a disconnect
unixSocket.setSocketState(QAbstractSocket::UnconnectedState);
@@ -227,7 +227,7 @@ void QLocalSocket::connectToServer(OpenMode openMode)
if (state() == ConnectedState || state() == ConnectingState) {
QString errorString = d->generateErrorString(QLocalSocket::OperationError, QLatin1String("QLocalSocket::connectToserver"));
setErrorString(errorString);
- emit error(QLocalSocket::OperationError);
+ emit errorOccurred(QLocalSocket::OperationError);
return;
}
@@ -237,15 +237,15 @@ void QLocalSocket::connectToServer(OpenMode openMode)
emit stateChanged(d->state);
if (d->serverName.isEmpty()) {
- d->errorOccurred(ServerNotFoundError,
- QLatin1String("QLocalSocket::connectToServer"));
+ d->setErrorAndEmit(ServerNotFoundError,
+ QLatin1String("QLocalSocket::connectToServer"));
return;
}
// create the socket
if (-1 == (d->connectingSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0, O_NONBLOCK))) {
- d->errorOccurred(UnsupportedSocketOperationError,
- QLatin1String("QLocalSocket::connectToServer"));
+ d->setErrorAndEmit(UnsupportedSocketOperationError,
+ QLatin1String("QLocalSocket::connectToServer"));
return;
}
@@ -281,7 +281,7 @@ void QLocalSocketPrivate::_q_connectToSocket()
name.sun_family = PF_UNIX;
if (sizeof(name.sun_path) < (uint)encodedConnectingPathName.size() + 1) {
QString function = QLatin1String("QLocalSocket::connectToServer");
- errorOccurred(QLocalSocket::ServerNotFoundError, function);
+ setErrorAndEmit(QLocalSocket::ServerNotFoundError, function);
return;
}
::memcpy(name.sun_path, encodedConnectingPathName.constData(),
@@ -292,17 +292,17 @@ void QLocalSocketPrivate::_q_connectToSocket()
{
case EINVAL:
case ECONNREFUSED:
- errorOccurred(QLocalSocket::ConnectionRefusedError, function);
+ setErrorAndEmit(QLocalSocket::ConnectionRefusedError, function);
break;
case ENOENT:
- errorOccurred(QLocalSocket::ServerNotFoundError, function);
+ setErrorAndEmit(QLocalSocket::ServerNotFoundError, function);
break;
case EACCES:
case EPERM:
- errorOccurred(QLocalSocket::SocketAccessError, function);
+ setErrorAndEmit(QLocalSocket::SocketAccessError, function);
break;
case ETIMEDOUT:
- errorOccurred(QLocalSocket::SocketTimeoutError, function);
+ setErrorAndEmit(QLocalSocket::SocketTimeoutError, function);
break;
case EAGAIN:
// Try again later, all of the sockets listening are full
@@ -320,7 +320,7 @@ void QLocalSocketPrivate::_q_connectToSocket()
delayConnect->setEnabled(true);
break;
default:
- errorOccurred(QLocalSocket::UnknownSocketError, function);
+ setErrorAndEmit(QLocalSocket::UnknownSocketError, function);
}
return;
}
@@ -336,7 +336,7 @@ void QLocalSocketPrivate::_q_connectToSocket()
q->emit connected();
} else {
QString function = QLatin1String("QLocalSocket::connectToServer");
- errorOccurred(QLocalSocket::UnknownSocketError, function);
+ setErrorAndEmit(QLocalSocket::UnknownSocketError, function);
}
connectingSocket = -1;
connectingName.clear();
@@ -461,15 +461,8 @@ void QLocalSocket::disconnectFromServer()
d->unixSocket.disconnectFromHost();
}
-#if QT_DEPRECATED_SINCE(5, 15)
QLocalSocket::LocalSocketError QLocalSocket::error() const
{
- return socketError();
-}
-#endif // QT_DEPRECATED_SINCE(5, 15)
-
-QLocalSocket::LocalSocketError QLocalSocket::socketError() const
-{
Q_D(const QLocalSocket);
switch (d->unixSocket.socketError()) {
case QAbstractSocket::ConnectionRefusedError:
@@ -536,8 +529,8 @@ bool QLocalSocket::waitForConnected(int msec)
const int result = qt_poll_msecs(&pfd, 1, timeout);
if (result == -1)
- d->errorOccurred(QLocalSocket::UnknownSocketError,
- QLatin1String("QLocalSocket::waitForConnected"));
+ d->setErrorAndEmit(QLocalSocket::UnknownSocketError,
+ QLatin1String("QLocalSocket::waitForConnected"));
else if (result > 0)
d->_q_connectToSocket();
} while (state() == ConnectingState && !timer.hasExpired(msec));
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 657790519b..48ffd87beb 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -91,7 +91,7 @@ void QLocalSocketPrivate::_q_winError(ulong windowsError, const QString &functio
if (state == QLocalSocket::UnconnectedState && currentState != QLocalSocket::ConnectingState)
emit q->disconnected();
}
- emit q->error(error);
+ emit q->errorOccurred(error);
}
QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(),
@@ -123,7 +123,7 @@ void QLocalSocket::connectToServer(OpenMode openMode)
if (state() == ConnectedState || state() == ConnectingState) {
d->error = OperationError;
d->errorString = tr("Trying to connect while connection is in progress");
- emit error(QLocalSocket::OperationError);
+ emit errorOccurred(QLocalSocket::OperationError);
return;
}
@@ -135,7 +135,7 @@ void QLocalSocket::connectToServer(OpenMode openMode)
d->error = ServerNotFoundError;
d->errorString = tr("%1: Invalid name").arg(QLatin1String("QLocalSocket::connectToServer"));
d->state = UnconnectedState;
- emit error(d->error);
+ emit errorOccurred(d->error);
emit stateChanged(d->state);
return;
}
@@ -330,15 +330,8 @@ void QLocalSocket::disconnectFromServer()
}
}
-#if QT_DEPRECATED_SINCE(5, 15)
QLocalSocket::LocalSocketError QLocalSocket::error() const
{
- return socketError();
-}
-#endif // QT_DEPRECATED_SINCE(5, 15)
-
-QLocalSocket::LocalSocketError QLocalSocket::socketError() const
-{
Q_D(const QLocalSocket);
return d->error;
}
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index b2eefa352f..eb5d181134 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -535,7 +535,7 @@ void QSocks5SocketEnginePrivate::initialize(Socks5Mode socks5Mode)
udpData = new QSocks5UdpAssociateData;
data = udpData;
udpData->udpSocket = new QUdpSocket(q);
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
udpData->udpSocket->setProperty("_q_networksession", q->property("_q_networksession"));
#endif
udpData->udpSocket->setProxy(QNetworkProxy::NoProxy);
@@ -549,7 +549,7 @@ void QSocks5SocketEnginePrivate::initialize(Socks5Mode socks5Mode)
}
data->controlSocket = new QTcpSocket(q);
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
data->controlSocket->setProperty("_q_networksession", q->property("_q_networksession"));
#endif
data->controlSocket->setProxy(QNetworkProxy::NoProxy);
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp
index 9916c75e65..c23b143de3 100644
--- a/src/network/socket/qtcpserver.cpp
+++ b/src/network/socket/qtcpserver.cpp
@@ -314,7 +314,7 @@ bool QTcpServer::listen(const QHostAddress &address, quint16 port)
d->serverSocketErrorString = tr("Operation on socket is not supported");
return false;
}
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket engine (if it has been set)
d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
#endif
@@ -436,7 +436,7 @@ bool QTcpServer::setSocketDescriptor(qintptr socketDescriptor)
d->serverSocketErrorString = tr("Operation on socket is not supported");
return false;
}
-#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket engine (if it has been set)
d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
#endif