From a76e662192fa6d2c245485c4b144db258d63d18a Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Sun, 11 Mar 2012 12:44:38 -0500 Subject: [PATCH] reset request coordinator after connection failure --- examples/wsperf/request.hpp | 8 ++++++++ examples/wsperf/wsperf.cpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/examples/wsperf/request.hpp b/examples/wsperf/request.hpp index 698d41d0ca..3c3dd07b47 100644 --- a/examples/wsperf/request.hpp +++ b/examples/wsperf/request.hpp @@ -109,6 +109,14 @@ public: value = m_requests.front(); m_requests.pop(); } + + void reset() { + boost::unique_lock lock(m_lock); + + while (!m_requests.empty()) { + m_requests.pop(); + } + } private: std::queue m_requests; boost::mutex m_lock; diff --git a/examples/wsperf/wsperf.cpp b/examples/wsperf/wsperf.cpp index e5e321e17b..c344ec98a0 100644 --- a/examples/wsperf/wsperf.cpp +++ b/examples/wsperf/wsperf.cpp @@ -174,6 +174,8 @@ int start_client(po::variables_map& vm) { // This will block until there is an error or the websocket closes endpoint.run(); + rc.reset(); + if (!reconnect) { break; } else {