From: Guus Sliepen Date: Wed, 27 Mar 2002 15:01:37 +0000 (+0000) Subject: Limit the amount of packets in a queue to 8. X-Git-Tag: release-1.0pre6~7 X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=5eba1e1f6feadb3f7efb1261bd65e1e9e40b7f2b Limit the amount of packets in a queue to 8. --- diff --git a/src/net.h b/src/net.h index f1493eb1..922c5cf1 100644 --- a/src/net.h +++ b/src/net.h @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.h,v 1.9.4.48 2002/03/22 11:43:48 guus Exp $ + $Id: net.h,v 1.9.4.49 2002/03/27 15:01:36 guus Exp $ */ #ifndef __TINC_NET_H__ @@ -42,6 +42,8 @@ #define MAXSOCKETS 128 /* Overkill... */ +#define MAXQUEUELENGTH 8 /* Maximum number of packats in a single queue */ + typedef struct mac_t { unsigned char x[6]; diff --git a/src/net_packet.c b/src/net_packet.c index 7216fb5f..fd2ae067 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_packet.c,v 1.1.2.12 2002/03/25 15:51:58 guus Exp $ + $Id: net_packet.c,v 1.1.2.13 2002/03/27 15:01:37 guus Exp $ */ #include "config.h" @@ -212,6 +212,9 @@ cp list_insert_tail(n->queue, copy); + if(n->queue->count > MAXQUEUELENGTH) + list_delete_head(n->queue); + if(!n->status.waitingforkey) send_req_key(n->nexthop->connection, myself, n);