================= CL_PacketEvent A packet has arrived from the main event loop ================= */
| 651 | ================= |
| 652 | */ |
| 653 | void CL_PacketEvent( netadr_t from, msg_t *msg ) { |
| 654 | clc.lastPacketTime = cls.realtime; |
| 655 | |
| 656 | if ( msg->cursize >= 4 && *(int *)msg->data == -1 ) { |
| 657 | CL_ConnectionlessPacket( from, msg ); |
| 658 | return; |
| 659 | } |
| 660 | |
| 661 | if ( cls.state < CA_CONNECTED ) { |
| 662 | return; // can't be a valid sequenced packet |
| 663 | } |
| 664 | |
| 665 | if ( msg->cursize < 8 ) { |
| 666 | Com_Printf ("%s: Runt packet\n",NET_AdrToString( from )); |
| 667 | return; |
| 668 | } |
| 669 | |
| 670 | // |
| 671 | // packet from server |
| 672 | // |
| 673 | if ( !NET_CompareAdr( from, clc.netchan.remoteAddress ) ) { |
| 674 | Com_DPrintf ("%s:sequenced packet without connection\n" |
| 675 | ,NET_AdrToString( from ) ); |
| 676 | // FIXME: send a client disconnect? |
| 677 | return; |
| 678 | } |
| 679 | |
| 680 | if (!Netchan_Process( &clc.netchan, msg) ) { |
| 681 | return; // out of order, duplicated, etc |
| 682 | } |
| 683 | |
| 684 | clc.lastPacketTime = cls.realtime; |
| 685 | CL_ParseServerMessage( msg ); |
| 686 | } |
| 687 | |
| 688 | /* |
| 689 | ================== |
no test coverage detected