diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp | 3 | ||||
-rw-r--r-- | src/network/socket/qtcpserver.cpp | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp b/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp index a7ab8c0977..3bd57f1d44 100644 --- a/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp +++ b/src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp @@ -51,7 +51,8 @@ void SslServer::incomingConnection(qintptr socketDescriptor) { QSslSocket *serverSocket = new QSslSocket; if (serverSocket->setSocketDescriptor(socketDescriptor)) { - connect(serverSocket, SIGNAL(encrypted()), this, SLOT(ready())); + addPendingConnection(serverSocket); + connect(serverSocket, &QSslSocket::encrypted, this, &SslServer::ready); serverSocket->startServerEncryption(); } else { delete serverSocket; diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp index 914c14877e..bf75666548 100644 --- a/src/network/socket/qtcpserver.cpp +++ b/src/network/socket/qtcpserver.cpp @@ -559,6 +559,10 @@ QTcpSocket *QTcpServer::nextPendingConnection() may not be usable with native socket functions, and should only be used with QTcpSocket::setSocketDescriptor(). + \note If another socket is created in the reimplementation + of this method, it needs to be added to the Pending Connections mechanism + by calling addPendingConnection(). + \note If you want to handle an incoming connection as a new QTcpSocket object in another thread you have to pass the socketDescriptor to the other thread and create the QTcpSocket object there and |