From 0b2f63108df4542fc5891e5a3ea9762849c29b9e Mon Sep 17 00:00:00 2001 From: rob-crane <28930454+Rob-Crane@users.noreply.github.com> Date: Wed, 26 Dec 2018 01:33:40 -0500 Subject: [PATCH 1/2] Remove websocket close call causing infinite recursion --- src/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7c2c22003..93c95e14e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -156,7 +156,6 @@ int main() { h.onDisconnection([&h](uWS::WebSocket ws, int code, char *message, size_t length) { - ws.close(); std::cout << "Disconnected" << std::endl; }); @@ -169,4 +168,4 @@ int main() { } h.run(); -} \ No newline at end of file +} From 6678f2bec6a3febc0a4503da27fafda47615657c Mon Sep 17 00:00:00 2001 From: rob-crane <28930454+Rob-Crane@users.noreply.github.com> Date: Sat, 5 Jan 2019 15:21:50 -0500 Subject: [PATCH 2/2] Exit on disconnect. --- src/main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 93c95e14e..9248c3ea7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,8 @@ +#include #include -#include #include + +#include #include "json.hpp" #include "FusionEKF.h" #include "tools.h" @@ -150,13 +152,14 @@ int main() { }); // end h.onMessage - h.onConnection([&h](uWS::WebSocket ws, uWS::HttpRequest req) { + h.onConnection([](uWS::WebSocket ws, uWS::HttpRequest req) { std::cout << "Connected!!!" << std::endl; }); - h.onDisconnection([&h](uWS::WebSocket ws, int code, + h.onDisconnection([](uWS::WebSocket ws, int code, char *message, size_t length) { std::cout << "Disconnected" << std::endl; + std::exit(0); }); int port = 4567;