This commit is contained in:
Chris Marsh
2017-07-25 09:27:48 -07:00
parent 866e6d1104
commit 7a6172a300
10 changed files with 176 additions and 78 deletions

View File

@@ -44,7 +44,8 @@ void RpcConnection::Open()
if (evt == message.MemberEnd() || !evt->value.IsString()) {
return;
}
if (!strcmp(cmd->value.GetString(), "DISPATCH") && !strcmp(evt->value.GetString(), "READY")) {
if (!strcmp(cmd->value.GetString(), "DISPATCH") &&
!strcmp(evt->value.GetString(), "READY")) {
state = State::Connected;
if (onConnect) {
onConnect();
@@ -54,7 +55,8 @@ void RpcConnection::Open()
}
else {
sendFrame.opcode = Opcode::Handshake;
sendFrame.length = JsonWriteHandshakeObj(sendFrame.message, sizeof(sendFrame.message), RpcVersion, appId);
sendFrame.length =
JsonWriteHandshakeObj(sendFrame.message, sizeof(sendFrame.message), RpcVersion, appId);
if (connection->Write(&sendFrame, sizeof(MessageFrameHeader) + sendFrame.length)) {
state = State::SentHandshake;
@@ -110,8 +112,7 @@ bool RpcConnection::Read(JsonDocument& message)
}
switch (readFrame.opcode) {
case Opcode::Close:
{
case Opcode::Close: {
message.ParseInsitu(readFrame.message);
lastErrorCode = message["code"].GetInt();
const auto& m = message["message"];