Skip to content

Commit e0b314c

Browse files
authored
Merge pull request #258 from geky/make-jussi-happy
Added handling for already connected sockets in LWIPInterface::connect
2 parents 8e6ce68 + 3c00785 commit e0b314c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

net/LWIPInterface/LWIPInterface.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ static void set_mac_address(void)
9494
/* Interface implementation */
9595
int LWIPInterface::connect()
9696
{
97+
// Check if we've already connected
98+
if (get_ip_address()) {
99+
return 0;
100+
}
101+
97102
// Set up network
98103
set_mac_address();
99104
init_netif(0, 0, 0);
@@ -118,6 +123,8 @@ int LWIPInterface::disconnect()
118123
dhcp_stop(&netif);
119124

120125
eth_arch_disable_interrupts();
126+
ip_addr[0] = '\0';
127+
mac_addr[0] = '\0';
121128

122129
return 0;
123130
}

0 commit comments

Comments
 (0)