Codechange: move logic whether there is enough space in a packet to write data into the Packet

This commit is contained in:
Rubidium
2021-04-18 09:26:06 +02:00
committed by rubidium42
parent c545cc9d70
commit a2051bad50
5 changed files with 37 additions and 23 deletions

View File

@@ -613,7 +613,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCmdNames()
/* Should SEND_MTU be exceeded, start a new packet
* (magic 5: 1 bool "more data" and one uint16 "command id", one
* byte for string '\0' termination and 1 bool "no more data" */
if (p->size + strlen(cmdname) + 5 >= SEND_MTU) {
if (p->CanWriteToPacket(strlen(cmdname) + 5)) {
p->Send_bool(false);
this->SendPacket(p);