1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00
This commit is contained in:
James Snyder 2011-09-28 17:13:42 -05:00
parent 0d54061858
commit 7b8642502b

View File

@ -30,7 +30,7 @@
* *
* This file is part of the uIP TCP/IP stack * 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> #include <stdio.h>
@ -274,7 +274,7 @@ PT_THREAD(handle_dhcp(void))
do { do {
send_discover(); send_discover();
s.timer_init = platform_timer_op( ELUA_DHCP_TIMER_ID, PLATFORM_TIMER_OP_START, 0 ); 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) { if(uip_newdata() && parse_msg() == DHCPOFFER) {
uip_flags &= ~UIP_NEWDATA; uip_flags &= ~UIP_NEWDATA;
s.state = STATE_OFFER_RECEIVED; s.state = STATE_OFFER_RECEIVED;
@ -294,7 +294,7 @@ PT_THREAD(handle_dhcp(void))
do { do {
send_request(); send_request();
s.timer_init = platform_timer_op( ELUA_DHCP_TIMER_ID, PLATFORM_TIMER_OP_START, 0 ); 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) { if(uip_newdata() && parse_msg() == DHCPACK) {
uip_flags &= ~UIP_NEWDATA; uip_flags &= ~UIP_NEWDATA;