From e042ae69dbe4f42e9e4441f4b5832cfe5ca89067 Mon Sep 17 00:00:00 2001 From: Marcus Eggenberger Date: Sun, 28 Jun 2009 16:08:12 +0200 Subject: [PATCH] An attempt to fix #682 - core crash on client connect when using ssl. As I'm unable to reproduce this bug, I'm just following a hunch here. Please let me know if it helps. seezer: ping! --- src/core/core.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/core.cpp b/src/core/core.cpp index 56784298..18f022b1 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -547,6 +547,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) { clientInfo[socket] = msg; // store for future reference reply["MsgType"] = "ClientInitAck"; SignalProxy::writeDataToDevice(socket, reply); + socket->flush(); // ensure that the write cache is flushed before we switch to ssl #ifdef HAVE_SSL // after we told the client that we are ssl capable we switch to ssl mode @@ -653,6 +654,7 @@ void Core::setupClientSession(QTcpSocket *socket, UserId uid) { else sess = createSession(uid); // Hand over socket, session then sends state itself disconnect(socket, 0, this, 0); + socket->flush(); // ensure that the write cache is flushed before we hand over the connection to another thread. blocksizes.remove(socket); clientInfo.remove(socket); if(!sess) { -- 2.20.1