Mercurial > irccd
changeset 142:74164ac3d01a
Irccd: fix slow server connection because of missing test
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 19 May 2016 20:56:22 +0200 |
parents | 2ce88e3a4759 |
children | 11113212576c |
files | lib/irccd/server-state-connecting.cpp |
diffstat | 1 files changed, 9 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/irccd/server-state-connecting.cpp Thu May 19 20:34:19 2016 +0200 +++ b/lib/irccd/server-state-connecting.cpp Thu May 19 20:56:22 2016 +0200 @@ -48,14 +48,12 @@ std::string host = info.host; int code; - /* libircclient requires # for SSL connection */ + // libircclient requires # for SSL connection. #if defined(WITH_SSL) - if (info.flags & ServerInfo::Ssl) { + if (info.flags & ServerInfo::Ssl) host.insert(0, 1, '#'); - } - if (!(info.flags & ServerInfo::SslVerify)) { + if (!(info.flags & ServerInfo::SslVerify)) irc_option_set(server.session(), LIBIRC_OPTION_SSL_NO_VERIFY); - } #endif if (info.flags & ServerInfo::Ipv6) { @@ -100,18 +98,15 @@ log::warning() << "server " << server.name() << ": error while connecting: "; log::warning() << irc_strerror(irc_errno(server.session())) << std::endl; - if (settings.reconnectTries != 0) { + if (settings.reconnectTries != 0) log::warning("server {}: retrying in {} seconds"_format(server.name(), settings.reconnectDelay)); - } server.next(std::make_unique<state::Disconnected>()); - } else { + } else irc_add_select_descriptors(server.session(), &setinput, &setoutput, reinterpret_cast<int *>(&maxfd)); - } } else { /* - * This is needed if irccd is started before DHCP or if - * DNS cache is outdated. + * This is needed if irccd is started before DHCP or if DNS cache is outdated. * * For more information see bug #190. */ @@ -126,6 +121,9 @@ server.next(std::make_unique<state::Disconnected>()); } else { m_started = true; + + if (irc_is_connected(server.session())) + irc_add_select_descriptors(server.session(), &setinput, &setoutput, reinterpret_cast<int *>(&maxfd)); } } }