summaryrefslogtreecommitdiff
path: root/netcore.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2014-01-21 01:01:43 +0100
committerTreeki <treeki@gmail.com>2014-01-21 01:01:43 +0100
commit26ad55851febe624145ac807dbf59376ba669eaf (patch)
tree4746daf7d106a18f17f9d96966800b04b6d148bc /netcore.cpp
parent8b32f42df825a03284f5c340499394b93dc1a65d (diff)
downloadbounce4-26ad55851febe624145ac807dbf59376ba669eaf.tar.gz
bounce4-26ad55851febe624145ac807dbf59376ba669eaf.zip
refactoring: add event handling functions to the Server/IRCServer interface
Diffstat (limited to '')
-rw-r--r--netcore.cpp13
1 files changed, 11 insertions, 2 deletions
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;
}