Skip to content

Commit a28032d

Browse files
committed
remove NO_PORT_BIND
1 parent 1ddebdd commit a28032d

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/WiFiClient.cpp

+1-26
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ extern "C"
4040
#include "include/ClientContext.h"
4141
#include "c_types.h"
4242

43-
44-
#define NO_PORT_BIND
45-
46-
#ifndef NO_PORT_BIND
47-
#define MIN_LOCAL_PORT 1024
48-
#define MAX_LOCAL_PORT 1124
49-
50-
static int g_localPort = MIN_LOCAL_PORT;
51-
#endif
52-
5343
ICACHE_FLASH_ATTR WiFiClient::WiFiClient()
5444
: _client(0)
5545
{
@@ -102,22 +92,7 @@ int ICACHE_FLASH_ATTR WiFiClient::connect(IPAddress ip, uint16_t port)
10292
tcp_pcb* pcb = tcp_new();
10393
if (!pcb)
10494
return 0;
105-
#ifndef NO_PORT_BIND
106-
while(true)
107-
{
108-
err_t err = tcp_bind(pcb, INADDR_ANY, g_localPort);
109-
if (++g_localPort == MAX_LOCAL_PORT)
110-
g_localPort = MIN_LOCAL_PORT;
111-
if (err == ERR_OK)
112-
break;
113-
if (err == ERR_USE) {
114-
esp_yield();
115-
continue;
116-
}
117-
tcp_abort(pcb);
118-
return 0;
119-
}
120-
#endif
95+
12196
ip_addr_t addr;
12297
addr.addr = ip;
12398
tcp_arg(pcb, this);

0 commit comments

Comments
 (0)