From 780e9580b7211ed5693a3ada7ff86741f4bedc2c Mon Sep 17 00:00:00 2001 From: Thad House Date: Wed, 19 Oct 2016 22:47:33 -0700 Subject: [PATCH] Ignores KeepAlive messages during initial handshakes (#128) Shouldn't happen normally, but could happen if handshakes take a longer then normal period of time. Closes #126 --- src/Dispatcher.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Dispatcher.cpp b/src/Dispatcher.cpp index 22c9f62293..e987ff38d6 100644 --- a/src/Dispatcher.cpp +++ b/src/Dispatcher.cpp @@ -403,6 +403,11 @@ bool DispatcherBase::ClientHandshake( DEBUG4("received init str=" << msg->str() << " id=" << msg->id() << " seq_num=" << msg->seq_num_uid()); if (msg->Is(Message::kServerHelloDone)) break; + // shouldn't receive a keep alive, but handle gracefully + if (msg->Is(Message::kKeepAlive)) { + msg = get_msg(); + continue; + } if (!msg->Is(Message::kEntryAssign)) { // unexpected message DEBUG("client: received message (" << msg->type() << ") other than entry assignment during initial handshake"); @@ -491,6 +496,11 @@ bool DispatcherBase::ServerHandshake( return false; } if (msg->Is(Message::kClientHelloDone)) break; + // shouldn't receive a keep alive, but handle gracefully + if (msg->Is(Message::kKeepAlive)) { + msg = get_msg(); + continue; + } if (!msg->Is(Message::kEntryAssign)) { // unexpected message DEBUG("server: received message ("