From 681e6f6bc0da258fde153f2e76095541ea69a788 Mon Sep 17 00:00:00 2001 From: ZuratonE Date: Wed, 6 Sep 2017 14:07:28 +0300 Subject: [PATCH 1/2] lm4f: EthernetClient clear cpcb on connect error --- hardware/lm4f/libraries/Ethernet/EthernetClient.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hardware/lm4f/libraries/Ethernet/EthernetClient.cpp b/hardware/lm4f/libraries/Ethernet/EthernetClient.cpp index 6e3b79c5cd8..efffe905fca 100644 --- a/hardware/lm4f/libraries/Ethernet/EthernetClient.cpp +++ b/hardware/lm4f/libraries/Ethernet/EthernetClient.cpp @@ -192,6 +192,8 @@ int EthernetClient::connect(IPAddress ip, uint16_t port, unsigned long timeout) if (cs->cpcb->state != ESTABLISHED) { _connected = false; + cs->cpcb = NULL; + return false; } /* Poll to determine if the peer is still alive */ From fd57d969279236af34101b7bd387033189ee1c21 Mon Sep 17 00:00:00 2001 From: robertinant Date: Thu, 21 Sep 2017 15:37:47 -0700 Subject: [PATCH 2/2] Update EthernetClient.cpp --- hardware/lm4f/libraries/Ethernet/EthernetClient.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/hardware/lm4f/libraries/Ethernet/EthernetClient.cpp b/hardware/lm4f/libraries/Ethernet/EthernetClient.cpp index efffe905fca..02fd9b1a39d 100644 --- a/hardware/lm4f/libraries/Ethernet/EthernetClient.cpp +++ b/hardware/lm4f/libraries/Ethernet/EthernetClient.cpp @@ -192,6 +192,7 @@ int EthernetClient::connect(IPAddress ip, uint16_t port, unsigned long timeout) if (cs->cpcb->state != ESTABLISHED) { _connected = false; + tcp_close((tcp_pcb*)cs->cpcb); cs->cpcb = NULL; return false; }