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 {