Rev 1989 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1989 | Rev 2038 | ||
|---|---|---|---|
| Line 74... | Line 74... | ||
| 74 | 74 | ||
| 75 | std::string str(data.begin(), data.end()); |
75 | std::string str(data.begin(), data.end()); |
| 76 | 76 | ||
| 77 | boost::algorithm::trim_right_if(str, boost::is_any_of("\r\n")); |
77 | boost::algorithm::trim_right_if(str, boost::is_any_of("\r\n")); |
| 78 | 78 | ||
| 79 | LOG. |
79 | LOG.Debug("Received: \"" + str + "\" from client " + boost::lexical_cast<std::string>(id) + " on server " + boost::lexical_cast<std::string>(this->server_id_)); |
| 80 | 80 | ||
| 81 | std::string* payload_str = new std::string(str); |
81 | std::string* payload_str = new std::string(str); |
| 82 | broker::Manager::Instance()->Post(broker::Message::Pointer(new broker::Message(broker::Message::CAN_RAW_MESSAGE, broker::Message::PayloadPointer(payload_str), this))); |
82 | broker::Manager::Instance()->Post(broker::Message::Pointer(new broker::Message(broker::Message::CAN_RAW_MESSAGE, broker::Message::PayloadPointer(payload_str), this))); |
| 83 | 83 | ||
| 84 | //LOG.Info("Sent..."); |
84 | //LOG.Info("Sent..."); |
| 85 | 85 | ||
| 86 | if (str == "q" || str == "quit") |
86 | if (str == "q" || str == "quit") |
| 87 | { |
87 | { |
| 88 | LOG. |
88 | LOG.Debug("Client " + boost::lexical_cast<std::string>(id) + " has requested to be disconnected."); |
| 89 | net::Manager::Instance()->Disconnect(id); |
89 | net::Manager::Instance()->Disconnect(id); |
| 90 | } |
90 | } |
| 91 | } |
91 | } |
| 92 | 92 | ||
| 93 | void CanDaemon::SlotOnNewClientHandler(net::SocketId id, net::SocketId server_id) |
93 | void CanDaemon::SlotOnNewClientHandler(net::SocketId id, net::SocketId server_id) |
| Line 105... | Line 105... | ||
| 105 | return; |
105 | return; |
| 106 | } |
106 | } |
| 107 | 107 | ||
| 108 | if (client_state == net::CLIENT_STATE_DISCONNECTED) |
108 | if (client_state == net::CLIENT_STATE_DISCONNECTED) |
| 109 | { |
109 | { |
| 110 | LOG. |
110 | LOG.Debug("Client " + boost::lexical_cast<std::string>(id) + " has disconnected."); |
| 111 | this->clients_.erase(id); |
111 | this->clients_.erase(id); |
| 112 | } |
112 | } |
| 113 | else if (client_state == net::CLIENT_STATE_CONNECTED) |
113 | else if (client_state == net::CLIENT_STATE_CONNECTED) |
| 114 | { |
114 | { |
| 115 | LOG. |
115 | LOG.Debug("Client " + boost::lexical_cast<std::string>(id) + " has connected."); |
| 116 | } |
116 | } |
| 117 | else |
117 | else |
| 118 | { |
118 | { |
| 119 | LOG.Debug("Got state: " + boost::lexical_cast<std::string>((int)client_state)); |
119 | LOG.Debug("Got state: " + boost::lexical_cast<std::string>((int)client_state)); |
| 120 | } |
120 | } |