mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-26 05:24:21 +01:00
Some network handling optimization
This commit is contained in:
parent
ac2cf3d847
commit
775227f24c
@ -71,7 +71,10 @@ bool Network::Select(int sock, struct timeval *tv)
|
|||||||
sds.events = POLLIN;
|
sds.events = POLLIN;
|
||||||
sds.revents = 0;
|
sds.revents = 0;
|
||||||
|
|
||||||
|
if (tv)
|
||||||
v = net_poll(&sds, 1, tv->tv_sec * 1000 + tv->tv_usec / 1000);
|
v = net_poll(&sds, 1, tv->tv_sec * 1000 + tv->tv_usec / 1000);
|
||||||
|
else
|
||||||
|
v = net_poll(&sds, 1, 0);
|
||||||
|
|
||||||
return v > 0;
|
return v > 0;
|
||||||
}
|
}
|
||||||
@ -87,11 +90,15 @@ void Network::InitNetwork()
|
|||||||
{
|
{
|
||||||
char myIP[16];
|
char myIP[16];
|
||||||
|
|
||||||
|
memset(myIP, 0, sizeof(myIP));
|
||||||
Gui::gui->status_bar->queueMessage("Getting IP address via DHCP...");
|
Gui::gui->status_bar->queueMessage("Getting IP address via DHCP...");
|
||||||
/* Try twice */
|
/* Try twice */
|
||||||
if (if_config(myIP, NULL, NULL, true) < 0) {
|
if (if_config(myIP, NULL, NULL, true) < 0) {
|
||||||
if (if_config(myIP, NULL, NULL, true) < 0)
|
if (if_config(myIP, NULL, NULL, true) < 0)
|
||||||
|
{
|
||||||
Gui::gui->status_bar->queueMessage("No DHCP reply");
|
Gui::gui->status_bar->queueMessage("No DHCP reply");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Gui::gui->status_bar->queueMessage("Got an address");
|
Gui::gui->status_bar->queueMessage("Got an address");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user