diff options
Diffstat (limited to 'protocols/Discord/src/gateway.cpp')
-rw-r--r-- | protocols/Discord/src/gateway.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp index 5dfcea52f5..eccf8aea90 100644 --- a/protocols/Discord/src/gateway.cpp +++ b/protocols/Discord/src/gateway.cpp @@ -120,7 +120,7 @@ bool CDiscordProto::GatewayThreadWorker() debugLogA("JSON received:\n%s", szJson.c_str()); JSONNode root = JSONNode::parse(szJson); if (root) - GatewayProcess(root); + bExit = GatewayProcess(root); } break; @@ -168,7 +168,7 @@ bool CDiscordProto::GatewayThreadWorker() ////////////////////////////////////////////////////////////////////////////////////// // handles server commands -void CDiscordProto::GatewayProcess(const JSONNode &pRoot) +bool CDiscordProto::GatewayProcess(const JSONNode &pRoot) { int opCode = pRoot["op"].as_int(); switch (opCode) { @@ -187,6 +187,10 @@ void CDiscordProto::GatewayProcess(const JSONNode &pRoot) } break; + case OPCODE_RECONNECT: // we need to reconnect asap + debugLogA("we need to reconnect, leaving worker thread"); + return true; + case OPCODE_INVALID_SESSION: // session invalidated if (pRoot["d"].as_bool()) // session can be resumed GatewaySendResume(); @@ -208,6 +212,8 @@ void CDiscordProto::GatewayProcess(const JSONNode &pRoot) default: debugLogA("ACHTUNG! Unknown opcode: %d, report it to developer", opCode); } + + return false; } ////////////////////////////////////////////////////////////////////////////////////// |