Hi all, Based on the previous conversation, I've refactored the renew and rebind logic to perform retries with a logarithmic backoff down to a minimum of 60 seconds as per rfc2131. Each step begins with a "start_*" function that will clean up the previous timers and set the current timer to the duration of the renew or rebind period. The "continue_*" function will then be scheduled to occur at an logarithmic backoff.
For example, at 50% of the lease duration, T1 will expire, calling the start_renew function. This will set the state to RENEWING and set T1 = T2 - T1. (i.e. 85% - 50% = 35% of the total lease time.) start_renew then calls continue_renew, which actually sends the renew request and schedules a retry to itself at (T1 /= 2), or 50% + 17.5% = 67.5% of the lease. This continues until T1 < 60 seconds. At the expiration of T2, the T1 timer is removed and a a similar procedure occurs, replacing renew with rebind and T1 with T2. At the expiration of "expire" all timers are removed and the DHCP procedure is restarted. Any lease_lost_cb is called at this time. If at any time during this procedure the recieved packet state machine recieves a new valid dhcp response, all timers will be removed and the start_bound procedure will be called, rescheduling the 3 timers with respect to the new lease. Please let me know if you have any questions or comments on this implementation. -Andrew Andrew LeCain (1): dhcp: refactor renew/rebind method gdhcp/client.c | 205 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 123 insertions(+), 82 deletions(-) -- 1.7.9.5 _______________________________________________ connman mailing list [email protected] https://lists.connman.net/mailman/listinfo/connman
