// 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 <arpa/inet.h>
#include <assert.h>
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),
// 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.
if (session[s].die && session[s].die <= TIME)
{
sessionkill(s, "Expired");
- if (++count >= config->cleanup_limit) break;
+ if (++count >= MAX_ACTIONS) break;
continue;
}
{
sessionshutdown(s, "No response to LCP ECHO requests");
STAT(session_timeout);
- if (++count >= config->cleanup_limit) break;
+ if (++count >= MAX_ACTIONS) break;
continue;
}
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
if (send)
cluster_send_session(s);
- if (++count >= config->cleanup_limit) break;
+ if (++count >= MAX_ACTIONS) break;
}
}
}
}
- 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);
/* 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)
{
}
}
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)