MCPcopy Create free account
hub / github.com/cuberite/cuberite / SendResponse

Method SendResponse

src/RCONServer.cpp:310–329  ·  view source on GitHub ↗

Sends a RCON packet back to the client

Source from the content-addressed store, hash-verified

308
309/// Sends a RCON packet back to the client
310void cRCONServer::cConnection::SendResponse(int a_RequestID, int a_PacketType, int a_PayloadLength, const char * a_Payload)
311{
312 ASSERT((a_PayloadLength == 0) || (a_Payload != NULL)); // Either zero data to send, or a valid payload ptr
313
314 char Buffer[4];
315 int Length = a_PayloadLength + 10;
316 IntToBuffer(Length, Buffer);
317 m_Outgoing.append(Buffer, 4);
318 IntToBuffer(a_RequestID, Buffer);
319 m_Outgoing.append(Buffer, 4);
320 IntToBuffer(a_PacketType, Buffer);
321 m_Outgoing.append(Buffer, 4);
322 if (a_PayloadLength > 0)
323 {
324 m_Outgoing.append(a_Payload, a_PayloadLength);
325 }
326 m_Outgoing.push_back(0);
327 m_Outgoing.push_back(0);
328 m_RCONServer.m_SocketThreads.NotifyWrite(this);
329}
330
331
332

Callers 1

FinishedMethod · 0.80

Calls 1

NotifyWriteMethod · 0.80

Tested by

no test coverage detected