inpkg puffer size increased and checked that there will only packets put in with PKGF_ackreq flag set.

origin
stpohle 22 years ago
parent 379fbcab52
commit 821b609549

@ -1,4 +1,4 @@
/* $Id: network.h,v 1.16 2004/02/04 22:56:55 patty21 Exp $ /* $Id: network.h,v 1.17 2004/02/08 22:49:42 stpohle Exp $
* network.h file... for everything what have to do with the network stuff * network.h file... for everything what have to do with the network stuff
*/ */
@ -10,7 +10,7 @@
#define MAX_UDPDATA 1024 #define MAX_UDPDATA 1024
#define PKG_RESENDCACHE_SIZE (64*1024) #define PKG_RESENDCACHE_SIZE (64*1024)
#define PKG_IN_INDEX_NUM 256 #define PKG_IN_INDEX_NUM 512
#define RESENDCACHE_TIMEOUT 400 #define RESENDCACHE_TIMEOUT 400
#define RESENDCACHE_TIMEOUT_MENU 3000 #define RESENDCACHE_TIMEOUT_MENU 3000
#define RESENDCACHE_RETRY 10 #define RESENDCACHE_RETRY 10

@ -1461,16 +1461,21 @@ inpkg_delplayer (int pl_nr) {
void void
send_pkg (struct pkg *packet, _net_addr * addr) send_pkg (struct pkg *packet, _net_addr * addr)
{ {
/* if the packet would be send to the ai player so ignore it */ /* check if the packet would be send to
if (PS_IS_aiplayer (players[addr->pl_nr].state)) * an AI_Player, so ignore it. */
if ((addr->pl_nr >= 0 && addr->pl_nr < MAX_PLAYERS) && PS_IS_aiplayer (players[addr->pl_nr].state))
return; return;
/* set the id for the packet and the network flags
* the id is needed for the inpkg index to check for
* double reached packets */
packet->h.id = HTON16 (pkg_lastid++); packet->h.id = HTON16 (pkg_lastid++);
if (bman.net_ai_family != PF_INET) if (bman.net_ai_family != PF_INET)
packet->h.flags = packet->h.flags | PKGF_ipv6; packet->h.flags = packet->h.flags | PKGF_ipv6;
udp_send (bman.sock, (char *) packet, NTOH16 (packet->h.len), &addr->sAddr, bman.net_ai_family); udp_send (bman.sock, (char *) packet, NTOH16 (packet->h.len), &addr->sAddr, bman.net_ai_family);
/* test if we have any important packet if so put it in the resend_cache */ /* if PKGF_ackreq is set add the packet to the resendcache
* so we can resend it if no PKF_ackreq returned for the packet. */
if (packet->h.flags & PKGF_ackreq) { if (packet->h.flags & PKGF_ackreq) {
if (rscache_add (addr, packet) == -1) if (rscache_add (addr, packet) == -1)
d_printf ("resend_cache overrun.... packet throw away.\n"); d_printf ("resend_cache overrun.... packet throw away.\n");
@ -1521,17 +1526,25 @@ do_pkg (struct pkg *packet, _net_addr * addr)
players[addr->pl_nr].net.pingreq = players[addr->pl_nr].net.pingack + 5; players[addr->pl_nr].net.pingreq = players[addr->pl_nr].net.pingack + 5;
/* test if we have any important packet */ /* test if we have any important packet */
if (packet->h.flags & PKGF_ackreq) if (packet->h.flags & PKGF_ackreq) {
/* we need to send an acknolege so the client
* knows we have got this packet and delete
* it from the resend cache. */
send_pkgack (addr, packet->h.typ, NTOH16 (packet->h.id)); send_pkgack (addr, packet->h.typ, NTOH16 (packet->h.id));
/* check the packet with the index */ /* check the packet with the index so we can
if (inpkg_check (packet->h.typ, NTOH16 (packet->h.id), addr) != -1) { * ignore packets we already have got
/* we have got this packet already */ * this is important to keep away from
d_printf ("do_pkg: double packet ignoring addr->pl_nr=%d\n", addr->pl_nr); * the bomb is dropped twice bug. */
if (addr->pl_nr >= 0 && addr->pl_nr < MAX_PLAYERS) if (inpkg_check (packet->h.typ, NTOH16 (packet->h.id), addr) != -1) {
players[addr->pl_nr].net.pkgopt.to_2sec++; /* we have got this packet already */
return 0; d_printf ("do_pkg: double packet ignoring addr->pl_nr=%d\n", addr->pl_nr);
} if (addr->pl_nr >= 0 && addr->pl_nr < MAX_PLAYERS)
players[addr->pl_nr].net.pkgopt.to_2sec++;
return 0;
}
}
/* forward packet */ /* forward packet */
if (GT_MP_PTPM) if (GT_MP_PTPM)

Loading…
Cancel
Save