X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcorenetwork.cpp;h=dd1bf2e712a565e9044919419079c3f962ebd0d0;hp=c42325f9173fd2f632977901bf7dc7259809d344;hb=738828e0d4377d0037d8a37c9b991c6fd627b406;hpb=73abdb11acdff97882a489c7bf98eb53967c2c6f diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index c42325f9..dd1bf2e7 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -457,16 +457,24 @@ void CoreNetwork::socketInitialized() return; } - emit socketOpen(identity, localAddress(), localPort(), peerAddress(), peerPort()); - Server server = usedServer(); + #ifdef HAVE_SSL - if (server.useSsl && !socket.isEncrypted()) + // Non-SSL connections enter here only once, always emit socketInitialized(...) in these cases + // SSL connections call socketInitialized() twice, only emit socketInitialized(...) on the first (not yet encrypted) run + if (!server.useSsl || !socket.isEncrypted()) { + emit socketInitialized(identity, localAddress(), localPort(), peerAddress(), peerPort()); + } + + if (server.useSsl && !socket.isEncrypted()) { + // We'll finish setup once we're encrypted, and called again return; + } +#else + emit socketInitialized(identity, localAddress(), localPort(), peerAddress(), peerPort()); #endif - socket.setSocketOption(QAbstractSocket::KeepAliveOption, true); - emit socketInitialized(identity, localAddress(), localPort(), peerAddress(), peerPort()); + socket.setSocketOption(QAbstractSocket::KeepAliveOption, true); // TokenBucket to avoid sending too much at once _messageDelay = 2200; // this seems to be a safe value (2.2 seconds delay)