Rev 981 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 981 | Rev 983 | ||
|---|---|---|---|
| Line 287... | Line 287... | ||
| 287 | return false; |
287 | return false; |
| 288 | } |
288 | } |
| 289 | 289 | ||
| 290 | unsigned int VirtualMachine::startSocketThread(string address, int port, unsigned int reconnectTimeout) |
290 | unsigned int VirtualMachine::startSocketThread(string address, int port, unsigned int reconnectTimeout) |
| 291 | { |
291 | { |
| 292 | SocketThread socketThread(address, port, reconnectTimeout); |
292 | SocketThread *socketThread = new SocketThread(address, port, reconnectTimeout); |
| 293 | mySocketThreads[socketThread |
293 | mySocketThreads[socketThread->getId()] = socketThread; |
| 294 | mySocketThreads[socketThread |
294 | mySocketThreads[socketThread->getId()]->start(); |
| 295 | 295 | ||
| 296 | return socketThread |
296 | return socketThread->getId(); |
| 297 | } |
297 | } |
| 298 | 298 | ||
| 299 | bool VirtualMachine::stopSocketThread(unsigned int id) |
299 | bool VirtualMachine::stopSocketThread(unsigned int id) |
| 300 | { |
300 | { |
| - | 301 | ||
| - | 302 | ||
| 301 | if (mySocketThreads.find(id) != mySocketThreads.end()) |
303 | if (mySocketThreads.find(id) != mySocketThreads.end()) |
| 302 | { |
304 | { |
| - | 305 | //mySocketThreads[id]->stop(); |
|
| - | 306 | delete mySocketThreads[id]; |
|
| - | 307 | ||
| 303 | mySocketThreads.erase(id); |
308 | mySocketThreads.erase(id); |
| 304 | return true; |
309 | return true; |
| 305 | } |
310 | } |
| 306 | 311 | ||
| 307 | return false; |
312 | return false; |
| Line 309... | Line 314... | ||
| 309 | 314 | ||
| 310 | void VirtualMachine::sendToSocketThread(unsigned int id, string data) |
315 | void VirtualMachine::sendToSocketThread(unsigned int id, string data) |
| 311 | { |
316 | { |
| 312 | if (mySocketThreads.find(id) != mySocketThreads.end()) |
317 | if (mySocketThreads.find(id) != mySocketThreads.end()) |
| 313 | { |
318 | { |
| 314 | mySocketThreads[id] |
319 | mySocketThreads[id]->send(data); |
| 315 | } |
320 | } |
| 316 | } |
321 | } |
| 317 | 322 | ||
| 318 | bool VirtualMachine::runExpression(string expression) |
323 | bool VirtualMachine::runExpression(string expression) |
| 319 | { |
324 | { |