mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
Fix uIP DHCP Lease Bug http://osdir.com/ml/network.uip.user/2007-12/msg00012.html
This commit is contained in:
parent
0d54061858
commit
7b8642502b
@ -30,7 +30,7 @@
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack
|
||||
*
|
||||
* @(#)$Id: dhcpc.c,v 1.2 2006/06/11 21:46:37 adam Exp $
|
||||
* @(#)$Id: dhcpc.c,v 1.1 2007/01/04 11:06:35 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -274,7 +274,7 @@ PT_THREAD(handle_dhcp(void))
|
||||
do {
|
||||
send_discover();
|
||||
s.timer_init = platform_timer_op( ELUA_DHCP_TIMER_ID, PLATFORM_TIMER_OP_START, 0 );
|
||||
PT_WAIT_UNTIL(&s.pt, uip_newdata() || platform_timer_get_diff_us( ELUA_DHCP_TIMER_ID, s.timer_init, platform_timer_op( ELUA_DHCP_TIMER_ID, PLATFORM_TIMER_OP_READ, 0 ) ) >= s.ticks );
|
||||
PT_YIELD_UNTIL(&s.pt, uip_newdata() || platform_timer_get_diff_us( ELUA_DHCP_TIMER_ID, s.timer_init, platform_timer_op( ELUA_DHCP_TIMER_ID, PLATFORM_TIMER_OP_READ, 0 ) ) >= s.ticks );
|
||||
if(uip_newdata() && parse_msg() == DHCPOFFER) {
|
||||
uip_flags &= ~UIP_NEWDATA;
|
||||
s.state = STATE_OFFER_RECEIVED;
|
||||
@ -294,7 +294,7 @@ PT_THREAD(handle_dhcp(void))
|
||||
do {
|
||||
send_request();
|
||||
s.timer_init = platform_timer_op( ELUA_DHCP_TIMER_ID, PLATFORM_TIMER_OP_START, 0 );
|
||||
PT_WAIT_UNTIL(&s.pt, uip_newdata() || platform_timer_get_diff_us( ELUA_DHCP_TIMER_ID, s.timer_init, platform_timer_op( ELUA_DHCP_TIMER_ID, PLATFORM_TIMER_OP_READ, 0 ) ) >= s.ticks );
|
||||
PT_YIELD_UNTIL(&s.pt, uip_newdata() || platform_timer_get_diff_us( ELUA_DHCP_TIMER_ID, s.timer_init, platform_timer_op( ELUA_DHCP_TIMER_ID, PLATFORM_TIMER_OP_READ, 0 ) ) >= s.ticks );
|
||||
|
||||
if(uip_newdata() && parse_msg() == DHCPACK) {
|
||||
uip_flags &= ~UIP_NEWDATA;
|
||||
|
Loading…
x
Reference in New Issue
Block a user