KD SOAP API Documentation  2.1
KDSoapSocketList.cpp
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 #include "KDSoapServer.h"
11 #include "KDSoapServerSocket_p.h"
12 #include "KDSoapSocketList_p.h"
13 #include <QDebug>
14 
16  : m_server(server)
17  , m_serverObject(server->createServerObject())
18  , m_totalConnectionCount(0)
19 {
20  Q_ASSERT(m_server);
21  Q_ASSERT(m_serverObject);
22 }
23 
25 {
26  delete m_serverObject;
27 }
28 
30 {
31  KDSoapServerSocket *socket = new KDSoapServerSocket(this, m_serverObject);
32  socket->setSocketDescriptor(socketDescriptor);
33 
34 #ifndef QT_NO_SSL
35  if (m_server->features() & KDSoapServer::Ssl) {
36  // We could call a virtual "m_server->setSslConfiguration(socket)" here,
37  // if more control is needed (e.g. due to SNI)
38  if (!m_server->sslConfiguration().isNull()) {
39  socket->setSslConfiguration(m_server->sslConfiguration());
40  }
41  socket->startServerEncryption();
42  }
43 #endif
44 
45  QObject::connect(socket, &KDSoapServerSocket::disconnected, socket, &KDSoapServerSocket::deleteLater);
46  m_sockets.insert(socket);
48  return socket;
49 }
50 
52 {
53  // qDebug() << Q_FUNC_INFO;
54  m_sockets.remove(socket);
55 }
56 
58 {
59  return m_sockets.count();
60 }
61 
63 {
64  for (KDSoapServerSocket *socket : qAsConst(m_sockets)) {
65  socket->close(); // will disconnect
66  }
67 }
68 
70 {
71  return m_totalConnectionCount.loadAcquire();
72 }
73 
75 {
76  m_totalConnectionCount.ref();
77  // qDebug() << m_totalConnectionCount << "sockets connected in" << QThread::currentThread();
78 }
79 
81 {
82  m_totalConnectionCount = 0;
83 }
void socketDeleted(KDSoapServerSocket *)
@ Ssl
HTTPS.
Definition: KDSoapServer.h:49
QSslConfiguration sslConfiguration() const
Features features() const
int totalConnectionCount() const
KDSoapServerSocket * handleIncomingConnection(int socketDescriptor)
void socketDeleted(KDSoapServerSocket *socket)
KDSoapSocketList(KDSoapServer *server)
void resetTotalConnectionCount()
int socketCount() const

© 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