MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ReceivePacket

Method ReceivePacket

src/network/network_server.cpp:222–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222std::unique_ptr<Packet> ServerNetworkGameSocketHandler::ReceivePacket()
223{
224 /* Only allow receiving when we have some buffer free; this value
225 * can go negative, but eventually it will become positive again. */
226 if (this->receive_limit <= 0) return nullptr;
227
228 /* We can receive a packet, so try that and if needed account for
229 * the amount of received data. */
230 std::unique_ptr<Packet> p = this->NetworkTCPSocketHandler::ReceivePacket();
231 if (p != nullptr) this->receive_limit -= p->Size();
232 return p;
233}
234
235NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvStatus status)
236{

Callers

nothing calls this directly

Calls 1

SizeMethod · 0.45

Tested by

no test coverage detected