Skip to content

Commit

Permalink
include hdl in message actions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Peter Thorson committed Mar 6, 2014
1 parent 9d8eced commit b2d698d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/broadcast_server/broadcast_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -92,7 +93,7 @@ class broadcast_server {
// queue message up for sending by processing thread
unique_lock<mutex> 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();
}
Expand Down

0 comments on commit b2d698d

Please sign in to comment.