Rev 1986 | Rev 1989 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1986 | Rev 1987 | ||
|---|---|---|---|
| Line 59... | Line 59... | ||
| 59 | std::string* payload_str; |
59 | std::string* payload_str; |
| 60 | 60 | ||
| 61 | payload_str = static_cast<std::string*>(message->GetPayload().get()); |
61 | payload_str = static_cast<std::string*>(message->GetPayload().get()); |
| 62 | std::string line = *payload_str; |
62 | std::string line = *payload_str; |
| 63 | 63 | ||
| 64 |
|
64 | net::Manager::Instance()->SendToAll(this->server_id_, common::Byteset(line.begin(), line.end())); |
| 65 | } |
65 | } |
| 66 | } |
66 | } |
| 67 | 67 | ||
| 68 | void CanDaemon::SlotOnNewDataHandler(net::SocketId id, common::Byteset data) |
68 | void CanDaemon::SlotOnNewDataHandler(net::SocketId id, common::Byteset data) |
| 69 | { |
69 | { |
| 70 | if (std::find(this->clients_.begin(), this->clients_.end(), id) == this->clients_.end()) |
70 | if (std::find(this->clients_.begin(), this->clients_.end(), id) == this->clients_.end()) |
| 71 | { |
71 | { |
| 72 | return; |
72 | return; |
| 73 | } |
73 | } |
| 74 | 74 | ||
| 75 | std::string str |
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.Info("Received: \"" + str + "\" from client " + boost::lexical_cast<std::string>(id) + " on server " + boost::lexical_cast<std::string>(this->server_id_)); |
79 | LOG.Info("Received: \"" + str + "\" from client " + boost::lexical_cast<std::string>(id) + " on server " + boost::lexical_cast<std::string>(this->server_id_)); |
| 80 | 80 | ||