face: detect websocket connection failure using ping/pong messages.
Change-Id: I66ef6a3921a56f1bb8e49fb6fdb4fa14b6a379c7
Refs: #1903
diff --git a/daemon/face/websocket-face.cpp b/daemon/face/websocket-face.cpp
index 79faf73..5b295b3 100644
--- a/daemon/face/websocket-face.cpp
+++ b/daemon/face/websocket-face.cpp
@@ -24,6 +24,7 @@
**/
#include "websocket-face.hpp"
+#include "core/global-io.hpp"
namespace nfd {
@@ -37,9 +38,9 @@
, m_server(server)
, m_closed(false)
{
+ this->setOnDemand(true);
}
-
void
WebSocketFace::sendInterest(const Interest& interest)
{
@@ -86,6 +87,7 @@
if (m_closed == false)
{
m_closed = true;
+ scheduler::cancel(m_pingEventId);
websocketpp::lib::error_code ecode;
m_server.close(m_handle, websocketpp::close::status::normal, "closed by nfd", ecode);