From 26ad55851febe624145ac807dbf59376ba669eaf Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 21 Jan 2014 01:01:43 +0100 Subject: refactoring: add event handling functions to the Server/IRCServer interface --- netcore.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'netcore.cpp') diff --git a/netcore.cpp b/netcore.cpp index 684d319..27769a6 100644 --- a/netcore.cpp +++ b/netcore.cpp @@ -131,8 +131,10 @@ int NetCore::execute() { for (int i = 0; i < serverCount; i++) { if (servers[i]->state == Server::CS_WAITING_DNS) servers[i]->tryConnectPhase(); - else if (servers[i]->state == Server::CS_TLS_HANDSHAKE) - servers[i]->tryTLSHandshake(); + else if (servers[i]->state == Server::CS_TLS_HANDSHAKE) { + if (servers[i]->tryTLSHandshake()) + servers[i]->connectedEvent(); + } if (servers[i]->sock != -1) { if (servers[i]->sock > maxFD) @@ -238,6 +240,13 @@ int NetCore::execute() { shutdown(listener, SHUT_RDWR); close(listener); + for (int i = 0; i < serverCount; i++) + delete servers[i]; + for (int i = 0; i < clientCount; i++) + delete clients[i]; + + serverCount = clientCount = 0; + return 0; } -- cgit v1.2.3