KD SOAP API Documentation  2.1
KDSoapServerThread_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Soap project.
4 **
5 ** SPDX-FileCopyrightText: 2010-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 #ifndef KDSOAPSERVERTHREAD_P_H
11 #define KDSOAPSERVERTHREAD_P_H
12 
13 #include <QHash>
14 #include <QMutex>
15 #include <QSemaphore>
16 #include <QThread>
17 class KDSoapServer;
18 class KDSoapSocketList;
19 
20 class KDSoapServerThreadImpl : public QObject
21 {
22  Q_OBJECT
23 public:
26 
27 public Q_SLOTS:
28  void handleIncomingConnection(int socketDescriptor, KDSoapServer *server);
29  void disconnectSocketsForServer(KDSoapServer *server, QSemaphore *semaphore);
30  void quit();
31 
32 public:
33  int socketCount();
34  int socketCountForServer(const KDSoapServer *server);
37 
38  void addIncomingConnection();
39 
40 private:
41  QMutex m_socketListMutex;
42  KDSoapSocketList *socketListForServer(KDSoapServer *server);
43  typedef QHash<KDSoapServer *, KDSoapSocketList *> SocketLists;
44  SocketLists m_socketLists;
45 
46  QAtomicInt m_incomingConnectionCount;
47 };
48 
49 class KDSoapServerThread : public QThread
50 {
51  Q_OBJECT
52 public:
53  explicit KDSoapServerThread(QObject *parent = 0);
55 
56  void startThread();
57  void quitThread();
58 
59  int socketCount() const;
60  int socketCountForServer(const KDSoapServer *server) const;
61  int totalConnectionCountForServer(const KDSoapServer *server) const;
63 
64  void disconnectSocketsForServer(KDSoapServer *server, QSemaphore &semaphore);
65  void handleIncomingConnection(int socketDescriptor, KDSoapServer *server);
66 
67 protected:
68  virtual void run() override;
69 
70 private:
71  void start(); // use startThread instead
72  void quit(); // use quitThread instead
74  QSemaphore m_semaphore;
75 };
76 
77 #endif // KDSOAPSERVERTHREAD_P_H
int totalConnectionCountForServer(const KDSoapServer *server)
void disconnectSocketsForServer(KDSoapServer *server, QSemaphore *semaphore)
void resetTotalConnectionCountForServer(const KDSoapServer *server)
int socketCountForServer(const KDSoapServer *server)
void handleIncomingConnection(int socketDescriptor, KDSoapServer *server)
int socketCountForServer(const KDSoapServer *server) const
void disconnectSocketsForServer(KDSoapServer *server, QSemaphore &semaphore)
KDSoapServerThread(QObject *parent=0)
int totalConnectionCountForServer(const KDSoapServer *server) const
void resetTotalConnectionCountForServer(const KDSoapServer *server)
virtual void run() override
void handleIncomingConnection(int socketDescriptor, KDSoapServer *server)

© 2010-2022 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 Tue Jun 13 2023 12:18:34 for KD SOAP API Documentation by doxygen 1.9.1