X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/b866448a74e526665477b5ea055ba4e970852b2f..aa77d4f89aa291e851c9be8a64ecfdb1434e83c9:/l2tpns.c diff --git a/l2tpns.c b/l2tpns.c index db73793..e9f768a 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -4,7 +4,7 @@ // Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced // vim: sw=8 ts=8 -char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.73.2.11 2005/05/30 02:55:41 bodea Exp $"; +char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.73.2.17 2005/07/03 02:40:22 bodea Exp $"; #include #include @@ -113,7 +113,6 @@ config_descriptt config_values[] = { CONFIG("setuid", target_uid, INT), CONFIG("dump_speed", dump_speed, BOOL), CONFIG("cleanup_interval", cleanup_interval, INT), - CONFIG("cleanup_limit", cleanup_limit, INT), CONFIG("multi_read_count", multi_read_count, INT), CONFIG("scheduler_fifo", scheduler_fifo, BOOL), CONFIG("lock_pages", lock_pages, BOOL), @@ -2063,7 +2062,12 @@ static void processtun(uint8_t * buf, int len) // Else discard. } -// Handle retries, timeouts +// +// Maximum number of actions to complete. +// This is to avoid sending out too many packets +// at once. +#define MAX_ACTIONS 500 + static int regular_cleanups(void) { static sessionidt s = 0; // Next session to check for actions on. @@ -2157,7 +2161,7 @@ static int regular_cleanups(void) if (session[s].die && session[s].die <= TIME) { sessionkill(s, "Expired"); - if (++count >= config->cleanup_limit) break; + if (++count >= MAX_ACTIONS) break; continue; } @@ -2166,7 +2170,7 @@ static int regular_cleanups(void) { sessionshutdown(s, "No response to LCP ECHO requests"); STAT(session_timeout); - if (++count >= config->cleanup_limit) break; + if (++count >= MAX_ACTIONS) break; continue; } @@ -2186,7 +2190,7 @@ static int regular_cleanups(void) LOG(4, s, session[s].tunnel, "No data in %d seconds, sending LCP ECHO\n", (int)(time_now - session[s].last_packet)); tunnelsend(b, 24, session[s].tunnel); // send it - if (++count >= config->cleanup_limit) break; + if (++count >= MAX_ACTIONS) break; } // Check for actions requested from the CLI @@ -2255,7 +2259,7 @@ static int regular_cleanups(void) if (send) cluster_send_session(s); - if (++count >= config->cleanup_limit) break; + if (++count >= MAX_ACTIONS) break; } } @@ -2277,7 +2281,7 @@ static int regular_cleanups(void) } } - if (count >= config->cleanup_limit) + if (count >= MAX_ACTIONS) return 1; // Didn't finish! LOG(3, 0, 0, "End regular cleanup (%d actions), next in %d seconds\n", count, config->cleanup_interval); @@ -2602,6 +2606,7 @@ static void mainloop(void) /* Handle timeouts. Make sure that this gets run anyway, even if there was * something to read, else under load this will never actually run.... + * */ if (config->cluster_iam_master && next_clean <= time_now) { @@ -3702,8 +3707,7 @@ static void update_config() } } memcpy(config->old_plugins, config->plugins, sizeof(config->plugins)); - if (!config->cleanup_interval) config->cleanup_interval = 2; - if (!config->cleanup_limit) config->cleanup_limit = 50; + if (!config->cleanup_interval) config->cleanup_interval = 10; if (!config->multi_read_count) config->multi_read_count = 10; if (!config->cluster_address) config->cluster_address = inet_addr(DEFAULT_MCAST_ADDR); if (!*config->cluster_interface)