| 73 | } |
| 74 | |
| 75 | bool TelnetResponder::SendGCodeReply() noexcept |
| 76 | { |
| 77 | MutexLocker lock(gcodeReplyMutex); |
| 78 | |
| 79 | if (gcodeReply != nullptr) |
| 80 | { |
| 81 | bool clearReply = false; |
| 82 | clientsServed++; |
| 83 | if (clientsServed < numSessions) |
| 84 | { |
| 85 | // Yes - make sure the Network class doesn't discard its buffers yet |
| 86 | // NB: This must happen here, because NetworkTransaction::Write() might already release OutputBuffers |
| 87 | gcodeReply->IncreaseReferences(1); |
| 88 | } |
| 89 | else |
| 90 | { |
| 91 | // No - clean up again later |
| 92 | clearReply = true; |
| 93 | } |
| 94 | |
| 95 | if (reprap.Debug(Module::Webserver)) |
| 96 | { |
| 97 | GetPlatform().MessageF(UsbMessage, "Sending G-Code reply to Telnet client %d of %d (length %u)\n", clientsServed, numSessions, gcodeReply->DataLength()); |
| 98 | } |
| 99 | |
| 100 | // Send the whole G-Code reply as plain text to the client |
| 101 | outStack.Push(gcodeReply); |
| 102 | |
| 103 | // Possibly clean up the G-code reply once again |
| 104 | if (clearReply) |
| 105 | { |
| 106 | gcodeReply = nullptr; |
| 107 | } |
| 108 | return true; |
| 109 | } |
| 110 | return false; |
| 111 | } |
| 112 | |
| 113 | // Do some work, returning true if we did anything significant |
| 114 | bool TelnetResponder::Spin() noexcept |
nothing calls this directly
no test coverage detected