MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / SendGCodeReply

Method SendGCodeReply

src/Networking/TelnetResponder.cpp:75–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75bool 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
114bool TelnetResponder::Spin() noexcept

Callers

nothing calls this directly

Calls 5

IncreaseReferencesMethod · 0.80
DebugMethod · 0.80
PushMethod · 0.80
MessageFMethod · 0.45
DataLengthMethod · 0.45

Tested by

no test coverage detected