From b8bece508a0e2bc131aad09f629e8efc061ade87 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sun, 21 Jun 2015 14:25:52 +0200
Subject: [PATCH] Fix DHCP client retries.
In order to have DHCP retries actually work dhcpc_appcall() must be called for PROCESS_EVENT_TIMER too.
---
apps/dhcp/dhcp.c | 11 +++++------
cpu/6502/ipconfig/ipconfig.c | 8 ++++----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/apps/dhcp/dhcp.c b/apps/dhcp/dhcp.c
index 2c9d35003..fd2861811 100644
--- a/apps/dhcp/dhcp.c
+++ b/apps/dhcp/dhcp.c
@@ -97,9 +97,9 @@ makestrings(void)
PROCESS_THREAD(dhcp_process, ev, data)
{
PROCESS_BEGIN();
-
+
ctk_window_new(&window, 28, 7, "DHCP");
-
+
CTK_WIDGET_ADD(&window, &getbutton);
CTK_WIDGET_ADD(&window, &statuslabel);
CTK_WIDGET_ADD(&window, &ipaddrlabel);
@@ -110,22 +110,21 @@ PROCESS_THREAD(dhcp_process, ev, data)
CTK_WIDGET_ADD(&window, &gatewayentry);
CTK_WIDGET_ADD(&window, &dnsserverlabel);
CTK_WIDGET_ADD(&window, &dnsserverentry);
-
+
CTK_WIDGET_FOCUS(&window, &getbutton);
ctk_window_open(&window);
dhcpc_init(uip_lladdr.addr, sizeof(uip_lladdr.addr));
-
while(1) {
PROCESS_WAIT_EVENT();
-
+
if(ev == ctk_signal_widget_activate) {
if(data == (process_data_t)&getbutton) {
dhcpc_request();
set_statustext("Requesting...");
}
- } else if(ev == tcpip_event) {
+ } else if(ev == tcpip_event || ev == PROCESS_EVENT_TIMER) {
dhcpc_appcall(ev, data);
} else if(ev == PROCESS_EVENT_EXIT ||
ev == ctk_signal_window_close) {
diff --git a/cpu/6502/ipconfig/ipconfig.c b/cpu/6502/ipconfig/ipconfig.c
index 5452b735a..7c7584b67 100644
--- a/cpu/6502/ipconfig/ipconfig.c
+++ b/cpu/6502/ipconfig/ipconfig.c
@@ -177,9 +177,9 @@ app_quit(void)
PROCESS_THREAD(ipconfig_process, ev, data)
{
PROCESS_BEGIN();
-
+
ctk_window_new(&window, 29, 14, "IP config");
-
+
CTK_WIDGET_ADD(&window, &requestbutton);
CTK_WIDGET_ADD(&window, &statuslabel);
CTK_WIDGET_ADD(&window, &ipaddrlabel);
@@ -208,11 +208,11 @@ PROCESS_THREAD(ipconfig_process, ev, data)
while(1) {
PROCESS_WAIT_EVENT();
-
+
if(ev == PROCESS_EVENT_MSG) {
makestrings();
ctk_window_redraw(&window);
- } else if(ev == tcpip_event) {
+ } else if(ev == tcpip_event || ev == PROCESS_EVENT_TIMER) {
dhcpc_appcall(ev, data);
} else if(ev == ctk_signal_button_activate) {
if(data == (process_data_t)&requestbutton) {