/** * @sa CL_ReadPacket * @sa NET_ReadMsg * @sa SV_Start */ void SV_ReadPacket (struct net_stream *s) { client_t *cl = (client_t *)NET_StreamGetData(s); struct dbuffer *msg; while ((msg = NET_ReadMsg(s))) { const int cmd = NET_ReadByte(msg); if (cmd == clc_oob) SV_ConnectionlessPacket(s, msg); else if (cl) SV_ExecuteClientMessage(cl, cmd, msg); else NET_StreamFree(s); free_dbuffer(msg); } }
/** * @sa CL_ReadPacket * @sa NET_ReadMsg * @sa SV_Start */ void SV_ReadPacket (struct net_stream *s) { client_t *cl = static_cast<client_t *>(NET_StreamGetData(s)); dbuffer *msg; while ((msg = NET_ReadMsg(s))) { const int cmd = NET_ReadByte(msg); if (cmd == clc_oob) SV_ConnectionlessPacket(s, msg); else if (cl) SV_ExecuteClientMessage(cl, cmd, msg); else { NET_StreamFree(s); s = NULL; } delete msg; } }