|
|
@ -1,4 +1,4 @@
|
|
|
|
/* $Id: pkgcache.c,v 1.10 2006/08/13 21:26:50 stpohle Exp $
|
|
|
|
/* $Id: pkgcache.c,v 1.11 2006/08/15 13:33:32 stpohle Exp $
|
|
|
|
* Resendcache work, We need this to resend lost packets over the network.
|
|
|
|
* Resendcache work, We need this to resend lost packets over the network.
|
|
|
|
* we will keep every packet with the PKGF_ackreq flag as long as we haven't
|
|
|
|
* we will keep every packet with the PKGF_ackreq flag as long as we haven't
|
|
|
|
* got any answer from the destination host. And resend the packet after a givin
|
|
|
|
* got any answer from the destination host. And resend the packet after a givin
|
|
|
@ -17,16 +17,7 @@ void rscache_init () {
|
|
|
|
rscache.count = 0;
|
|
|
|
rscache.count = 0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* add a new packet to the list
|
|
|
|
/* add a new packet to the list */
|
|
|
|
|
|
|
|
|
|
|
|
struct _rscache_entry {
|
|
|
|
|
|
|
|
Uint32 timestamp; // pointer to the timestamp
|
|
|
|
|
|
|
|
signed char retry; // retry's how many times we tryed this
|
|
|
|
|
|
|
|
_net_addr addr; // the address
|
|
|
|
|
|
|
|
char packet[MAX_UDPDATA]; // the packet
|
|
|
|
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void rscache_add (_net_addr *addr, struct pkg *packet) {
|
|
|
|
void rscache_add (_net_addr *addr, struct pkg *packet) {
|
|
|
|
int len;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
|
|
|
@ -97,13 +88,14 @@ void rscache_loop () {
|
|
|
|
|
|
|
|
|
|
|
|
if (timestamp - rscache.entry[i].timestamp >= timeout
|
|
|
|
if (timestamp - rscache.entry[i].timestamp >= timeout
|
|
|
|
&& rscache.entry[i].retry >= RESENDCACHE_RETRY) {
|
|
|
|
&& rscache.entry[i].retry >= RESENDCACHE_RETRY) {
|
|
|
|
d_printf ("Data Send Timeout (%s:%s) Delete now Package Fill %d, Pos %d\n",
|
|
|
|
d_printf ("Data Send Timeout (%s:%s) Delete Fill %d, Pos %d\n",
|
|
|
|
rscache.entry[i].addr.host, rscache.entry[i].addr.port, rscache.count, i);
|
|
|
|
rscache.entry[i].addr.host, rscache.entry[i].addr.port, rscache.count, i);
|
|
|
|
if (rscache.entry[i].addr.pl_nr >= 0 && rscache.entry[i].addr.pl_nr < MAX_PLAYERS)
|
|
|
|
if (rscache.entry[i].addr.pl_nr >= 0 && rscache.entry[i].addr.pl_nr < MAX_PLAYERS)
|
|
|
|
players[rscache.entry[i].addr.pl_nr].net.pkgopt.to_2sec++;
|
|
|
|
players[rscache.entry[i].addr.pl_nr].net.pkgopt.to_2sec++;
|
|
|
|
|
|
|
|
|
|
|
|
rscache_del (&rscache.entry[i].addr, rscache.entry[i].packet.h.typ,
|
|
|
|
rscache_del (&rscache.entry[i].addr, rscache.entry[i].packet.h.typ,
|
|
|
|
NTOH16(rscache.entry[i].packet.h.id));
|
|
|
|
NTOH16(rscache.entry[i].packet.h.id));
|
|
|
|
|
|
|
|
if (i > 0) i--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|