Close existing RPC connections at exit

Fixes #314
This commit is contained in:
Srivats P 2020-12-27 12:52:47 +05:30
parent c97a359f85
commit 4ae6b564d3
2 changed files with 4 additions and 0 deletions

View File

@ -33,6 +33,8 @@ RpcServer::RpcServer(bool perConnLogs)
RpcServer::~RpcServer() RpcServer::~RpcServer()
{ {
close();
emit closed();
} }
bool RpcServer::registerService(::google::protobuf::Service *service, bool RpcServer::registerService(::google::protobuf::Service *service,
@ -73,6 +75,7 @@ void RpcServer::incomingConnection(qintptr socketDescriptor)
connect(this, SIGNAL(notifyClients(int, SharedProtobufMessage)), connect(this, SIGNAL(notifyClients(int, SharedProtobufMessage)),
conn, SLOT(sendNotification(int, SharedProtobufMessage))); conn, SLOT(sendNotification(int, SharedProtobufMessage)));
connect(this, SIGNAL(closed()), thread, SLOT(quit()));
thread->start(); thread->start();
} }

View File

@ -44,6 +44,7 @@ public:
QHostAddress address, quint16 tcpPortNum); QHostAddress address, quint16 tcpPortNum);
signals: signals:
void closed();
void notifyClients(int notifType, SharedProtobufMessage notifData); void notifyClients(int notifType, SharedProtobufMessage notifData);
protected: protected: