|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: pkgcache.c,v 1.12 2006/08/15 15:00:32 stpohle Exp $
|
|
|
|
|
/* $Id: pkgcache.c,v 1.13 2006/08/19 23:41:47 stpohle Exp $
|
|
|
|
|
* 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
|
|
|
|
|
* got any answer from the destination host. And resend the packet after a givin
|
|
|
|
@ -21,7 +21,7 @@ void rscache_init () {
|
|
|
|
|
void rscache_add (_net_addr *addr, struct pkg *packet) {
|
|
|
|
|
int len;
|
|
|
|
|
|
|
|
|
|
d_printf ("rscache_add: addr %p, pkg %p\n", addr, packet);
|
|
|
|
|
// d_printf ("rscache_add: addr %p, pkg %p\n", addr, packet);
|
|
|
|
|
/* check if there is still some free space left. */
|
|
|
|
|
if (rscache.count >= PKG_RESENDCACHE_SIZE) {
|
|
|
|
|
d_printf ("rscache_add no free rscache entry left.\n");
|
|
|
|
@ -46,7 +46,7 @@ void rscache_delnr (int nr) {
|
|
|
|
|
for (a = nr; a < rscache.count - 1; a++)
|
|
|
|
|
rscache.entry[nr] = rscache.entry[nr+1];
|
|
|
|
|
rscache.count--;
|
|
|
|
|
d_printf ("rscache_delnr: element %d deleted.\n", nr);
|
|
|
|
|
// d_printf ("rscache_delnr: element %d deleted.\n", nr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
d_printf ("rscache_delnr: number is out of range (%d)\n", nr);
|
|
|
|
@ -58,14 +58,13 @@ void rscache_delnr (int nr) {
|
|
|
|
|
int rscache_del (_net_addr *addr, unsigned char typ, short unsigned int id) {
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
d_printf ("rscache_del: addr %p (pl_nr:%d, typ:%d, id:%d\n", addr, addr->pl_nr, typ, id);
|
|
|
|
|
// d_printf ("rscache_del: addr %p (pl_nr:%d, typ:%d, id:%d\n", addr, addr->pl_nr, typ, id);
|
|
|
|
|
|
|
|
|
|
for (i = 0; (i < rscache.count) && (i < PKG_RESENDCACHE_SIZE); i++) {
|
|
|
|
|
if (rscache.entry[i].addr.pl_nr == addr->pl_nr &&
|
|
|
|
|
NTOH16(rscache.entry[i].packet.h.id) == id &&
|
|
|
|
|
rscache.entry[i].packet.h.typ == typ) { // found element
|
|
|
|
|
rscache_delnr (i);
|
|
|
|
|
d_printf ("rscache_del: element %d deleted.\n", i);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|