KD SOAP 2.0.0
Loading...
Searching...
No Matches
KDSoapServerThread_p.h
1/****************************************************************************
2**
3** This file is part of the KD Soap library.
4**
5** SPDX-FileCopyrightText: 2010-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6**
7** SPDX-License-Identifier: LicenseRef-KDAB-KDSoap-AGPL3-Modified OR LicenseRef-KDAB-KDSoap OR LicenseRef-KDAB-KDSoap-US
8**
9** Licensees holding valid commercial KD Soap licenses may use this file in
10** accordance with the KD Soap Commercial License Agreement provided with
11** the Software.
12**
13** Contact info@kdab.com if any conditions of this licensing are not clear to you.
14**
15****************************************************************************/
16#ifndef KDSOAPSERVERTHREAD_P_H
17#define KDSOAPSERVERTHREAD_P_H
18
19#include <QThread>
20#include <QSemaphore>
21#include <QMutex>
22#include <QHash>
23class KDSoapServer;
24class KDSoapSocketList;
25
26class KDSoapServerThreadImpl : public QObject
27{
28 Q_OBJECT
29public:
30 KDSoapServerThreadImpl();
31 ~KDSoapServerThreadImpl();
32
33public Q_SLOTS:
34 void handleIncomingConnection(int socketDescriptor, KDSoapServer *server);
35 void disconnectSocketsForServer(KDSoapServer *server, QSemaphore *semaphore);
36 void quit();
37
38public:
39 int socketCount();
40 int socketCountForServer(const KDSoapServer *server);
41 int totalConnectionCountForServer(const KDSoapServer *server);
42 void resetTotalConnectionCountForServer(const KDSoapServer *server);
43
44 void addIncomingConnection();
45
46private:
47 QMutex m_socketListMutex;
48 KDSoapSocketList *socketListForServer(KDSoapServer *server);
49 typedef QHash<KDSoapServer *, KDSoapSocketList *> SocketLists;
50 SocketLists m_socketLists;
51
52 QAtomicInt m_incomingConnectionCount;
53};
54
55class KDSoapServerThread : public QThread
56{
57 Q_OBJECT
58public:
59 explicit KDSoapServerThread(QObject *parent = 0);
60 ~KDSoapServerThread();
61
62 void startThread();
63 void quitThread();
64
65 int socketCount() const;
66 int socketCountForServer(const KDSoapServer *server) const;
67 int totalConnectionCountForServer(const KDSoapServer *server) const;
68 void resetTotalConnectionCountForServer(const KDSoapServer *server);
69
70 void disconnectSocketsForServer(KDSoapServer *server, QSemaphore &semaphore);
71 void handleIncomingConnection(int socketDescriptor, KDSoapServer *server);
72
73protected:
74 virtual void run() override;
75
76private:
77 void start(); // use startThread instead
78 void quit(); // use quitThread instead
79 KDSoapServerThreadImpl *d;
80 QSemaphore m_semaphore;
81};
82
83#endif // KDSOAPSERVERTHREAD_P_H
Definition: KDSoapServer.h:36

© 2010-2021 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-soap/
Generated on Thu Apr 16 2026 15:35:51 for KD SOAP by doxygen 1.9.6