From b2d698d3ca3b0212b20a26624a315fdc54944d1f Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Thu, 6 Mar 2014 11:59:38 -0600 Subject: [PATCH] include hdl in message actions This is not strictly necessary for the broadcast server example. As this example is commonly used as a starting point for new programs the lack of hdl on message action is a source of surprising behavior. --- examples/broadcast_server/broadcast_server.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/broadcast_server/broadcast_server.cpp b/examples/broadcast_server/broadcast_server.cpp index 29c18b6aa0..bdb01fe444 100644 --- a/examples/broadcast_server/broadcast_server.cpp +++ b/examples/broadcast_server/broadcast_server.cpp @@ -34,7 +34,8 @@ enum action_type { struct action { action(action_type t, connection_hdl h) : type(t), hdl(h) {} - action(action_type t, server::message_ptr m) : type(t), msg(m) {} + action(action_type t, connection_hdl h, server::message_ptr m) + : type(t), hdl(h), msg(m) {} action_type type; websocketpp::connection_hdl hdl; @@ -92,7 +93,7 @@ public: // queue message up for sending by processing thread unique_lock lock(m_action_lock); //std::cout << "on_message" << std::endl; - m_actions.push(action(MESSAGE,msg)); + m_actions.push(action(MESSAGE,hdl,msg)); lock.unlock(); m_action_cond.notify_one(); }