Added handling for already connected sockets in LWIPInterface::connect

pull/2231/head
Christopher Haster 2016-06-09 05:34:49 -05:00
parent 9eac5102fd
commit df5c05f38c
1 changed files with 7 additions and 0 deletions

View File

@ -94,6 +94,11 @@ static void set_mac_address(void)
/* Interface implementation */
int LWIPInterface::connect()
{
// Check if we've already connected
if (get_ip_address()) {
return 0;
}
// Set up network
set_mac_address();
init_netif(0, 0, 0);
@ -118,6 +123,8 @@ int LWIPInterface::disconnect()
dhcp_stop(&netif);
eth_arch_disable_interrupts();
ip_addr[0] = '\0';
mac_addr[0] = '\0';
return 0;
}