# HG changeset patch # User David Demelier # Date 1463684182 -7200 # Node ID 74164ac3d01aa7df2c5a3620a4605b4121fa04e9 # Parent 2ce88e3a4759c26e67a03259019c4bfeff929f2d Irccd: fix slow server connection because of missing test diff -r 2ce88e3a4759 -r 74164ac3d01a lib/irccd/server-state-connecting.cpp --- 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()); - } else { + } else irc_add_select_descriptors(server.session(), &setinput, &setoutput, reinterpret_cast(&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()); } else { m_started = true; + + if (irc_is_connected(server.session())) + irc_add_select_descriptors(server.session(), &setinput, &setoutput, reinterpret_cast(&maxfd)); } } }