Commit 99361847 authored by Alessandro Rubini's avatar Alessandro Rubini

rvlan: change timeout policy (save CPU time)

This has no real visible effect on the user.

Since commit 74af8ff8, we don't report all states at every timeout, so
there is no reason to have a short timeout if in verbose mode.
Moreover, 0.1s is a little too aggressive for intermediate states,
considering that unresponsive radius servers take a few seconds to be
reported.

And this removes a white space error in the same code area.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 12efd53e
#!/bin/sh
F=/tmp/rvlan-is-verbose
rm -f $F
killall -USR2 radiusvlan || exit 1
usleep 500000
if [ -f /tmp/rvlan-is-verbose ]; then
echo "radiusvlan verbose level is now $(cat $F)"
else
echo "radiusvlan not responding"
fi
......@@ -625,19 +625,20 @@ int rvlan_poll_devices(int sock)
struct rvlan_dev *dev;
fd_set rdset;
/* run once a minute, but be faster if verbose */
struct timeval to = {verbose ? 3 : 60, 0};
struct timeval to = {60, 0};
int ret, nrfd;
FD_ZERO(&rdset);
FD_SET(sock, &rdset);
nrfd = sock + 1;
nrfd = sock + 1;
for (dev = devs; dev; dev = dev->next) {
/* If needed, shorten timeout */
if (dev->fsm_state != RVLAN_DOWN &&
dev->fsm_state != RVLAN_SNIFF &&
dev->fsm_state != RVLAN_CONFIGURED) {
to.tv_sec = 0;
to.tv_usec = 100 * 1000;
to.tv_usec = 500 * 1000;
}
/* If needed, wait for this fd too */
if (dev->poll_fd >= 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment