summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-16 11:14:21 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-21 16:42:34 +0000
commit72bd5d1db9921c30b932eacbce1d58a205d286a8 (patch)
tree24fc9bea05100e8563cd77c27e619de289d9b2f8
parent42c6ea4f6c29845d68e865b19a73a09cc6d0bdbe (diff)
QtNetwork documentation: Emphasize QTcpServer::addPendingConnection().
Add note mentioning it to QTcpSocket::incomingConnection() and update SSL socket server code snippet accordingly. Change-Id: I9d228dabde76f9e9cd5140edf08be09a588066c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/network/doc/snippets/code/src_network_ssl_qsslsocket.cpp3
-rw-r--r--src/network/socket/qtcpserver.cpp4
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