-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxyserversocket.cpp
More file actions
31 lines (26 loc) · 883 Bytes
/
proxyserversocket.cpp
File metadata and controls
31 lines (26 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "proxyserversocket.h"
#include "serversidetcpsocket.h"
#include <QSslSocket>
tProxyServerSocket::tProxyServerSocket(const QString &workdir, const QString &cadir, long serial, QObject *parent) : QTcpServer(parent),m_workdir(workdir),m_cadir(cadir),m_serial(serial)
{
connect(this,&QTcpServer::newConnection,this,&tProxyServerSocket::onNewConnection);
}
long tProxyServerSocket::getSerial()
{
return ++m_serial;
}
void tProxyServerSocket::onNewConnection()
{
while (hasPendingConnections())
{
tServersideTcpSocket *sock=qobject_cast<tServersideTcpSocket *>(nextPendingConnection());
Q_ASSERT(sock);
Q_UNUSED(sock);
}
}
void tProxyServerSocket::incomingConnection(qintptr handle)
{
QSslSocket *sock=new tServersideTcpSocket(m_workdir, m_cadir, this);
sock->setSocketDescriptor(handle);
addPendingConnection(sock);
}