| 220 | } |
| 221 | |
| 222 | std::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 | |
| 235 | NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvStatus status) |
| 236 | { |