1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-06 05:21:22 +03:00

remove NO_PORT_BIND

This commit is contained in:
Markus Sattler 2015-04-03 14:26:41 +02:00
parent 0efbe3a0c8
commit a1f0c6feb9

View File

@ -40,16 +40,6 @@ extern "C"
#include "include/ClientContext.h"
#include "c_types.h"
#define NO_PORT_BIND
#ifndef NO_PORT_BIND
#define MIN_LOCAL_PORT 1024
#define MAX_LOCAL_PORT 1124
static int g_localPort = MIN_LOCAL_PORT;
#endif
ICACHE_FLASH_ATTR WiFiClient::WiFiClient()
: _client(0)
{
@ -102,22 +92,7 @@ int ICACHE_FLASH_ATTR WiFiClient::connect(IPAddress ip, uint16_t port)
tcp_pcb* pcb = tcp_new();
if (!pcb)
return 0;
#ifndef NO_PORT_BIND
while(true)
{
err_t err = tcp_bind(pcb, INADDR_ANY, g_localPort);
if (++g_localPort == MAX_LOCAL_PORT)
g_localPort = MIN_LOCAL_PORT;
if (err == ERR_OK)
break;
if (err == ERR_USE) {
esp_yield();
continue;
}
tcp_abort(pcb);
return 0;
}
#endif
ip_addr_t addr;
addr.addr = ip;
tcp_arg(pcb, this);