KD SOAP API Documentation  2.2
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 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 // clazy:excludeall=ctor-missing-parent-argument
21 class KDSoapServerThreadImpl : public QObject
22 {
23  Q_OBJECT
24 public:
25  KDSoapServerThreadImpl(); // created on stack, clazy:exclude=ctor-missing-parent-argument
27 
28 public Q_SLOTS:
29  void handleIncomingConnection(int socketDescriptor, KDSoapServer *server);
30  void disconnectSocketsForServer(KDSoapServer *server, QSemaphore *semaphore);
31  void quit();
32 
33 public:
34  int socketCount();
35  int socketCountForServer(const KDSoapServer *server);
38 
39  void addIncomingConnection();
40 
41 private:
42  QMutex m_socketListMutex;
43  KDSoapSocketList *socketListForServer(KDSoapServer *server);
44  typedef QHash<KDSoapServer *, KDSoapSocketList *> SocketLists;
45  SocketLists m_socketLists;
46 
47  QAtomicInt m_incomingConnectionCount;
48 };
49 
50 class KDSoapServerThread : public QThread
51 {
52  Q_OBJECT
53 public:
54  explicit KDSoapServerThread(QObject *parent = 0);
56 
57  void startThread();
58  void quitThread();
59 
60  int socketCount() const;
61  int socketCountForServer(const KDSoapServer *server) const;
62  int totalConnectionCountForServer(const KDSoapServer *server) const;
64 
65  void disconnectSocketsForServer(KDSoapServer *server, QSemaphore &semaphore);
66  void handleIncomingConnection(int socketDescriptor, KDSoapServer *server);
67 
68 protected:
69  virtual void run() override;
70 
71 private:
72  void start(); // use startThread instead
73  void quit(); // use quitThread instead
75  QSemaphore m_semaphore;
76 };
77 
78 #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-2024 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 by doxygen 1.9.1