From 775227f24c706deedd29efdd309b5f396f324fa1 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sat, 6 Mar 2010 15:34:44 +0000 Subject: [PATCH] Some network handling optimization --- Src/NetworkWii.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Src/NetworkWii.h b/Src/NetworkWii.h index cc7e4fd..d18b350 100644 --- a/Src/NetworkWii.h +++ b/Src/NetworkWii.h @@ -71,7 +71,10 @@ bool Network::Select(int sock, struct timeval *tv) sds.events = POLLIN; sds.revents = 0; - v = net_poll(&sds, 1, tv->tv_sec * 1000 + tv->tv_usec / 1000); + if (tv) + v = net_poll(&sds, 1, tv->tv_sec * 1000 + tv->tv_usec / 1000); + else + v = net_poll(&sds, 1, 0); return v > 0; } @@ -87,11 +90,15 @@ void Network::InitNetwork() { char myIP[16]; + memset(myIP, 0, sizeof(myIP)); Gui::gui->status_bar->queueMessage("Getting IP address via DHCP..."); /* Try twice */ if (if_config(myIP, NULL, NULL, true) < 0) { if (if_config(myIP, NULL, NULL, true) < 0) + { Gui::gui->status_bar->queueMessage("No DHCP reply"); + return; + } } Gui::gui->status_bar->queueMessage("Got an address"); }