Rev 1986 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1986 | Rev 1987 | ||
|---|---|---|---|
| Line 80... | Line 80... | ||
| 80 | { |
80 | { |
| 81 | std::string packet = "TEXT"; |
81 | std::string packet = "TEXT"; |
| 82 | packet += common::PadNumber(output.length() + 1, 4); |
82 | packet += common::PadNumber(output.length() + 1, 4); |
| 83 | packet += output; |
83 | packet += output; |
| 84 | 84 | ||
| 85 | net::Manager::Instance()->SendTo(request_id, packet); |
85 | net::Manager::Instance()->SendTo(request_id, common::Byteset(packet.begin(), packet.end())); |
| 86 | } |
86 | } |
| 87 | 87 | ||
| 88 | void Console::SlotOnNewData(net::SocketId id, common::Byteset data) |
88 | void Console::SlotOnNewData(net::SocketId id, common::Byteset data) |
| 89 | { |
89 | { |
| 90 | this->io_service_.post(boost::bind(&Console::SlotOnNewDataHandler, this, id, data)); |
90 | this->io_service_.post(boost::bind(&Console::SlotOnNewDataHandler, this, id, data)); |
| Line 112... | Line 112... | ||
| 112 | } |
112 | } |
| 113 | 113 | ||
| 114 | 114 | ||
| 115 | //LOG.Debug(std::string(__FUNCTION__) + " called!"); |
115 | //LOG.Debug(std::string(__FUNCTION__) + " called!"); |
| 116 | 116 | ||
| 117 | if (data. |
117 | if (data.size() == 0) |
| 118 | { |
118 | { |
| 119 | LOG.Error(std::string(__FUNCTION__) + " got empty data!"); |
119 | LOG.Error(std::string(__FUNCTION__) + " got empty data!"); |
| 120 | return; |
120 | return; |
| 121 | } |
121 | } |
| 122 | 122 | ||
| 123 | std::string s(data. |
123 | std::string s(data.begin(), data.end()); |
| 124 | 124 | ||
| 125 | if (s.length() < 8) |
125 | if (s.length() < 8) |
| 126 | { |
126 | { |
| 127 | LOG.Error(std::string(__FUNCTION__) + " got a packet which is to short, less then 8 bytes: \"" + s + "\""); |
127 | LOG.Error(std::string(__FUNCTION__) + " got a packet which is to short, less then 8 bytes: \"" + s + "\""); |
| 128 | return; |
128 | return; |
| Line 242... | Line 242... | ||
| 242 | 242 | ||
| 243 | std::string packet = "PROM"; |
243 | std::string packet = "PROM"; |
| 244 | packet += common::PadNumber(prompt.length() + 1, 4); |
244 | packet += common::PadNumber(prompt.length() + 1, 4); |
| 245 | packet += *prompt; |
245 | packet += *prompt; |
| 246 | 246 | ||
| 247 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), packet); |
247 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), common::Byteset(packet.begin(), packet.end())); |
| 248 | return handle_scope.Close(v8::Boolean::New(true)); |
248 | return handle_scope.Close(v8::Boolean::New(true)); |
| 249 | } |
249 | } |
| 250 | 250 | ||
| 251 | Value Console::Export_AutoCompleteResponse(const v8::Arguments& args) |
251 | Value Console::Export_AutoCompleteResponse(const v8::Arguments& args) |
| 252 | { |
252 | { |
| Line 266... | Line 266... | ||
| 266 | 266 | ||
| 267 | std::string packet = "COMP"; |
267 | std::string packet = "COMP"; |
| 268 | packet += common::PadNumber(result.length() + 1, 4); |
268 | packet += common::PadNumber(result.length() + 1, 4); |
| 269 | packet += *result; |
269 | packet += *result; |
| 270 | 270 | ||
| 271 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), packet); |
271 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), common::Byteset(packet.begin(), packet.end())); |
| 272 | return handle_scope.Close(v8::Boolean::New(true)); |
272 | return handle_scope.Close(v8::Boolean::New(true)); |
| 273 | } |
273 | } |
| 274 | 274 | ||
| 275 | Value Console::Export_LogToClient(const v8::Arguments& args) |
275 | Value Console::Export_LogToClient(const v8::Arguments& args) |
| 276 | { |
276 | { |
| Line 292... | Line 292... | ||
| 292 | 292 | ||
| 293 | std::string packet = "TEXT"; |
293 | std::string packet = "TEXT"; |
| 294 | packet += common::PadNumber(line.length() + 1, 4); |
294 | packet += common::PadNumber(line.length() + 1, 4); |
| 295 | packet += line; |
295 | packet += line; |
| 296 | 296 | ||
| 297 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), packet); |
297 | net::Manager::Instance()->SendTo(args[0]->Uint32Value(), common::Byteset(packet.begin(), packet.end())); |
| 298 | return handle_scope.Close(v8::Boolean::New(true)); |
298 | return handle_scope.Close(v8::Boolean::New(true)); |
| 299 | } |
299 | } |
| 300 | 300 | ||
| 301 | Value Console::Export_DisconnectClient(const v8::Arguments& args) |
301 | Value Console::Export_DisconnectClient(const v8::Arguments& args) |
| 302 | { |
302 | { |