mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
lwip2 updates: no more git sub-sub-module deps, faster checksum, backlog limitation and other fixes (#6887)
* upstream lwIP is now downloaded by a makefile, not subsubmoduled * lwip2: upstream lwIP not sub-sub-modules anymore lwip2: Allow IPv4 and IPv6 DNS and SNTP server configured via DHCP to co-exist (patch against upstream) * lwip2: enable tcp-listen-with-backlog feature * lwip2 submodule update: - enable more efficient chksum algorithm thanks to Richard Allen - enable tcp listener with backlog * more comments, fix backlog management, fix API * move default value definition in .cpp because one must not believe it can be redefined before including WiFiServer.h * improved backlog handling, it is no more a breaking change
This commit is contained in:
@ -60,6 +60,13 @@ int serverAccept (int srvsock)
|
||||
|
||||
void WiFiServer::begin (uint16_t port)
|
||||
{
|
||||
return begin(port, !0);
|
||||
}
|
||||
|
||||
void WiFiServer::begin (uint16_t port, uint8_t backlog)
|
||||
{
|
||||
if (!backlog)
|
||||
return;
|
||||
_port = port;
|
||||
return begin();
|
||||
}
|
||||
@ -109,13 +116,13 @@ void WiFiServer::begin ()
|
||||
|
||||
|
||||
// store int into pointer
|
||||
_pcb = int2pcb(sock);
|
||||
_listen_pcb = int2pcb(sock);
|
||||
}
|
||||
|
||||
bool WiFiServer::hasClient ()
|
||||
{
|
||||
struct pollfd p;
|
||||
p.fd = pcb2int(_pcb);
|
||||
p.fd = pcb2int(_listen_pcb);
|
||||
p.events = POLLIN;
|
||||
return poll(&p, 1, 0) && p.revents == POLLIN;
|
||||
}
|
||||
@ -134,7 +141,7 @@ size_t WiFiServer::write (const uint8_t *buf, size_t size)
|
||||
|
||||
void WiFiServer::close ()
|
||||
{
|
||||
if (pcb2int(_pcb) >= 0)
|
||||
::close(pcb2int(_pcb));
|
||||
_pcb = int2pcb(-1);
|
||||
if (pcb2int(_listen_pcb) >= 0)
|
||||
::close(pcb2int(_listen_pcb));
|
||||
_listen_pcb = int2pcb(-1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user