diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c index 4c91fcde2..68423e4ec 100644 --- a/src/main.c +++ b/src/main.c @@ -389,19 +389,21 @@ std::string GetFullProgDir(char *argv0) static bool Connect() { - EventReturn MOD_RESULT; - FOREACH_RESULT(I_OnPreServerConnect, OnPreServerConnect()); - if (MOD_RESULT != EVENT_CONTINUE) - { - return (MOD_RESULT == EVENT_ALLOW ? true : false); - } - /* Connect to the remote server */ int servernum = 1; for (std::list<Uplink *>::iterator curr_uplink = Config.Uplinks.begin(); curr_uplink != Config.Uplinks.end(); ++curr_uplink, ++servernum) { uplink_server = *curr_uplink; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnPreServerConnect, OnPreServerConnect(*curr_uplink, servernum)); + if (MOD_RESULT != EVENT_CONTINUE) + { + if (MOD_RESULT == EVENT_STOP) + break; + return true; + } + try { new UplinkSocket(uplink_server->host, uplink_server->port, Config.LocalHost ? Config.LocalHost : "", uplink_server->ipv6); @@ -416,6 +418,8 @@ static bool Connect() return true; } + uplink_server = NULL; + return false; } |