Do not poll during discover. Add a polling tunable to the interface

struct to be able to turn polling on/off.

Tested by:	Larry Rosenman <ler@lerctr.org>
This commit is contained in:
Martin Blapp 2003-08-07 14:58:46 +00:00
parent c53bcc89ca
commit 44b6b1aaa4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118605
2 changed files with 26 additions and 4 deletions

View file

@ -260,8 +260,13 @@ int main (argc, argv, envp)
#ifdef __FreeBSD__
set_ieee80211 (tmp);
#endif
/* Init some interface vars, enable polling */
#ifdef ENABLE_POLLING_MODE
tmp -> forcediscover = 0;
tmp -> linkstate = 0;
tmp -> polling = 1;
#endif /* ifdef ENABLE_POLLING_MODE */
if (interfaces) {
interface_reference (&tmp -> next,
interfaces, MDL);
@ -944,8 +949,10 @@ void bind_lease (client)
(long)(client -> active -> renewal - cur_time));
client -> state = S_BOUND;
#ifdef ENABLE_POLLING_MODE
/* Init some interface vars, enable polling */
client -> interface -> linkstate = HAVELINK;
client -> interface -> forcediscover = 0;
client -> interface -> polling = 1;
#endif /* ifdef ENABLE_POLLING_MODE */
reinitialize_interfaces ();
go_daemon ();
@ -1409,6 +1416,11 @@ void send_discover (cpp)
int interval;
int increase = 1;
#ifdef ENABLE_POLLING_MODE
/* Disable polling for this interface */
client -> interface -> polling = 0;
#endif
/* Figure out how long it's been since we started transmitting. */
interval = cur_time - client -> first_sending;
@ -1552,6 +1564,10 @@ void state_panic (cpp)
log_info ("bound: renewal in %ld %s.",
(long)(client -> active -> renewal -
cur_time), "seconds");
#ifdef ENABLE_POLLING_MODE
/* Enable polling for thsi interface */
client -> interface -> polling = 1;
#endif
add_timeout (client -> active -> renewal,
state_bound, client, 0, 0);
} else {
@ -1609,6 +1625,12 @@ void state_panic (cpp)
}
log_info ("No working leases in persistent database - sleeping.");
#ifdef ENABLE_POLLING_MODE
/* Enable polling for this interface */
client -> interface -> polling = 1;
#endif
script_init (client, "FAIL", (struct string_list *)0);
if (client -> alias)
script_write_params (client, "alias_", client -> alias);
@ -3341,12 +3363,11 @@ void state_link (cpp)
struct interface_info *ip;
struct client_state *client;
#ifdef DEBUG
printf ("Polling interface status\n");
#endif
for (ip = interfaces; ip; ip = ip -> next) {
if (! ip -> polling)
continue;
#ifdef DEBUG
printf ("%s: Polling interface state\n", ip -> name);
for (client = ip -> client;
client; client = client -> next) {
printf ("%s: client state of %d\n", ip -> name, ip -> client -> state);

View file

@ -786,6 +786,7 @@ struct interface_info {
int ieee80211; /* True if media is ieee802.11 */
int havemedia; /* True if we have a media table */
int linkstate; /* True if we have link */
int polling; /* True if polling is enabled */
int forcediscover; /* True if a discover is needed */
int index; /* Its index. */
int rfdesc; /* Its read file descriptor. */