MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / onClientConnected

Method onClientConnected

sources/webserver/QtHttpServer.cpp:76–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76void QtHttpServer::onClientConnected(void)
77{
78 while (m_sockServer->hasPendingConnections())
79 {
80 if (QTcpSocket* sock = m_sockServer->nextPendingConnection())
81 {
82 if (m_netOrigin->accessAllowed(sock->peerAddress(), sock->localAddress()))
83 {
84 connect(sock, &QTcpSocket::disconnected, this, &QtHttpServer::onClientDisconnected);
85
86 if (m_useSsl)
87 {
88 if (QSslSocket* ssl = qobject_cast<QSslSocket*> (sock))
89 {
90 connect(ssl, SslErrorSignal(&QSslSocket::sslErrors), this, &QtHttpServer::onClientSslErrors);
91 connect(ssl, &QSslSocket::encrypted, this, &QtHttpServer::onClientSslEncrypted);
92 connect(ssl, &QSslSocket::peerVerifyError, this, &QtHttpServer::onClientSslPeerVerifyError);
93 connect(ssl, &QSslSocket::modeChanged, this, &QtHttpServer::onClientSslModeChanged);
94 ssl->setLocalCertificateChain(m_sslCerts);
95 ssl->setPrivateKey(m_sslKey);
96 ssl->setPeerVerifyMode(QSslSocket::AutoVerifyPeer);
97 ssl->startServerEncryption();
98 }
99 }
100
101 QtHttpClientWrapper* wrapper = new QtHttpClientWrapper(
102 sock, m_netOrigin->isLocalAddress(sock->peerAddress(), sock->localAddress()), this);
103 m_socksClientsHash.insert(sock, wrapper);
104 emit clientConnected(wrapper->getGuid());
105 }
106 else
107 {
108 sock->close();
109 }
110 }
111 }
112}
113
114void QtHttpServer::onClientDisconnected(void)
115{

Callers

nothing calls this directly

Calls 5

accessAllowedMethod · 0.80
setPrivateKeyMethod · 0.80
isLocalAddressMethod · 0.80
getGuidMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected