Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv19452
Modified Files:
dhcp-client-states.c dhcp-client.c
Log Message:
fixed up alarm handling
Index: dhcp-client-states.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client-states.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** dhcp-client-states.c 19 Dec 2002 18:00:30 -0000 1.16
--- dhcp-client-states.c 21 Dec 2002 16:17:52 -0000 1.17
***************
*** 602,608 ****
next_timer = timer_peek_next_timer(dc->timer);
-
time_before = time(NULL);
if(timer_set_next(dc->timer)) {
FATAL_MESSAGE
--- 602,608 ----
next_timer = timer_peek_next_timer(dc->timer);
time_before = time(NULL);
+ /* now fire off the next timer. */
if(timer_set_next(dc->timer)) {
FATAL_MESSAGE
***************
*** 618,629 ****
* difference. */
- time_after = time(NULL);
- time_interval = time_after - time_before; /* number of seconds elapsed. */
-
if(peek_interrupt_type() != INTERRUPT_ALARM) {
if(time_interval < 0) {
/* someone has been b0rking the system clock. */
WARN_MESSAGE("the system clock is skewed or you've been messing with it. i'm going to just use the next timer and hope for the best.");
} else {
--- 618,631 ----
* difference. */
if(peek_interrupt_type() != INTERRUPT_ALARM) {
+ time_after = time(NULL);
+ time_interval = time_after - time_before; /* number of seconds elapsed. */
+
if(time_interval < 0) {
+
/* someone has been b0rking the system clock. */
WARN_MESSAGE("the system clock is skewed or you've been messing with it. i'm going to just use the next timer and hope for the best.");
+
} else {
***************
*** 637,644 ****
next_timer = 1; /* give at least one second. */
timer_add_trigger(dc->timer, next_timer, timer_get_current_id(dc->timer));
}
}
!
/* bring the raw network devices back up. we'll probably
* need them: FIXME, revamp into one network module that uses
--- 639,653 ----
next_timer = 1; /* give at least one second. */
+ /* we just set our next timer to atleast one. this
+ * has one implication. if we're firing off other
+ * signals to the daemon (HUP for example) all the
+ * time it will never get the alarm. opinion: you
+ * shouldn't HUP your daemon constantly. otherwise
+ * we at most lag by one second which is not bad. */
+
timer_add_trigger(dc->timer, next_timer, timer_get_current_id(dc->timer));
}
}
!
/* bring the raw network devices back up. we'll probably
* need them: FIXME, revamp into one network module that uses
Index: dhcp-client.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-client.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** dhcp-client.c 19 Dec 2002 18:00:31 -0000 1.13
--- dhcp-client.c 21 Dec 2002 16:17:52 -0000 1.14
***************
*** 210,213 ****
--- 210,214 ----
case INTERRUPT_NONE:
+ /* no more interrupts. we're done. */
break;
***************
*** 227,230 ****
--- 228,233 ----
case INTERRUPT_ALARM:
+
+ /* if alarm then check for timer type so we can set our state accordingly. */
switch (timer_get_current_id(dc->timer)) {
|