summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobin Helgelin <robin@connectedtable.com>2010-04-21 10:14:02 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-05-06 07:54:33 (GMT)
commit4620b0fc7a48c643400a42eb9e9cc0a82ad0be9a (patch)
treeb9b93e341405281424edeb715c861d91a5492b4c /src
parenta9fb306a1cf1308a3f8b9bb12ed01aed1f6f6f8d (diff)
downloadQt-4620b0fc7a48c643400a42eb9e9cc0a82ad0be9a.zip
Qt-4620b0fc7a48c643400a42eb9e9cc0a82ad0be9a.tar.gz
Qt-4620b0fc7a48c643400a42eb9e9cc0a82ad0be9a.tar.bz2
Keep support for maximum pending connections in derived QTcpServer
By adding a new function to the class QTcpServer it's now possible to extend QTcpserver functionality with for instance SSL capabilities and still keep the support for maximum pending connections. Task-number: QTBUG-1875 Reviewed-by: Peter Hartmann Reviewed-by: Markus Goetz Merge-Request: 568
Diffstat (limited to 'src')
-rw-r--r--src/network/socket/qtcpserver.cpp15
-rw-r--r--src/network/socket/qtcpserver.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp
index 932126d..a259eee 100644
--- a/src/network/socket/qtcpserver.cpp
+++ b/src/network/socket/qtcpserver.cpp
@@ -572,6 +572,21 @@ void QTcpServer::incomingConnection(int socketDescriptor)
QTcpSocket *socket = new QTcpSocket(this);
socket->setSocketDescriptor(socketDescriptor);
+ addPendingConnection(socket);
+}
+
+/*!
+ This function is called by QTcpServer::incomingConnection()
+ to add a socket to the list of pending incoming connections.
+
+ \note Don't forget to call this member from reimplemented
+ incomingConnection() if you do not want to break the
+ Pending Connections mechanism.
+
+ \sa incomingConnection()
+*/
+void QTcpServer::addPendingConnection(QTcpSocket* socket)
+{
d_func()->pendingConnections.append(socket);
}
diff --git a/src/network/socket/qtcpserver.h b/src/network/socket/qtcpserver.h
index 7aebffe..b206678 100644
--- a/src/network/socket/qtcpserver.h
+++ b/src/network/socket/qtcpserver.h
@@ -93,6 +93,7 @@ public:
protected:
virtual void incomingConnection(int handle);
+ void addPendingConnection(QTcpSocket* socket);
Q_SIGNALS:
void newConnection();