From 120fe1b069ad6eda51da3a8d615c0a3fc5e65e14 Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Mon, 31 Jul 2017 15:40:31 -0700 Subject: [PATCH] Make these use my helper functions --- src/rpc_connection.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/rpc_connection.cpp b/src/rpc_connection.cpp index d408fdd..a8d6e9f 100644 --- a/src/rpc_connection.cpp +++ b/src/rpc_connection.cpp @@ -36,16 +36,9 @@ void RpcConnection::Open() if (state == State::SentHandshake) { JsonDocument message; if (Read(message)) { - auto cmd = message.FindMember("cmd"); - if (cmd == message.MemberEnd() || !cmd->value.IsString()) { - return; - } - auto evt = message.FindMember("evt"); - if (evt == message.MemberEnd() || !evt->value.IsString()) { - return; - } - if (!strcmp(cmd->value.GetString(), "DISPATCH") && - !strcmp(evt->value.GetString(), "READY")) { + auto cmd = GetStrMember(&message, "cmd"); + auto evt = GetStrMember(&message, "evt"); + if (cmd && evt && !strcmp(cmd, "DISPATCH") && !strcmp(evt, "READY")) { state = State::Connected; if (onConnect) { onConnect();