1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

emulation on host: fix nasty delay (#5840)

emulation with socket: fix nasty delay
        properly check all return values (read() returning 0 indicates closed peer)
        ClientContext::state() triggers read() to check for closed peer

uart emulation on tty: add cmdline -b debug option to disable raw tty

hide annoying MOCK messages, add cmdline -v option to show them

uart emulation on tty: check more return values

emulation on host: tcp/udp port shifting: new cmdline -s(port Shift) option
This commit is contained in:
david gauchard
2019-03-05 16:59:39 +01:00
committed by GitHub
parent 22eeb94587
commit 61a8a6b14e
13 changed files with 169 additions and 82 deletions

View File

@ -89,7 +89,7 @@ public:
void setMulticastTTL(int ttl)
{
(void)ttl;
//fprintf(stderr, MOCK "TODO: UdpContext::setMulticastTTL\n");
//mockverbose("TODO: UdpContext::setMulticastTTL\n");
}
// warning: handler is called from tcp stack context
@ -112,7 +112,7 @@ public:
{
if (!isValidOffset(pos))
{
fprintf(stderr, MOCK "UDPContext::seek too far (%zd >= %zd)\n", pos, _inbufsize);
mockverbose("UDPContext::seek too far (%zd >= %zd)\n", pos, _inbufsize);
exit(EXIT_FAILURE);
}
mockUDPSwallow(pos, _inbuf, _inbufsize);
@ -134,13 +134,13 @@ public:
uint32_t getDestAddress()
{
fprintf(stderr, MOCK "TODO: implement UDP getDestAddress\n");
mockverbose("TODO: implement UDP getDestAddress\n");
return 0; //ip_hdr* iphdr = GET_IP_HDR(_rx_buf);
}
uint16_t getLocalPort()
{
fprintf(stderr, MOCK "TODO: implement UDP getLocalPort\n");
mockverbose("TODO: implement UDP getLocalPort\n");
return 0; //
}
@ -175,7 +175,7 @@ public:
void flush()
{
//fprintf(stderr, MOCK "UdpContext::flush() does not follow arduino's flush concept\n");
//mockverbose("UdpContext::flush() does not follow arduino's flush concept\n");
//exit(EXIT_FAILURE);
// would be:
_inbufsize = 0;
@ -185,7 +185,7 @@ public:
{
if (size + _outbufsize > sizeof _outbuf)
{
fprintf(stderr, MOCK "UdpContext::append: increase CCBUFSIZE (%d -> %zd)\n", CCBUFSIZE, (size + _outbufsize));
mockverbose("UdpContext::append: increase CCBUFSIZE (%d -> %zd)\n", CCBUFSIZE, (size + _outbufsize));
exit(EXIT_FAILURE);
}
@ -225,7 +225,7 @@ private:
//ip4_addr_set_u32(&ip_2_ip4(_dst), *(uint32_t*)addr);
}
else
fprintf(stderr, MOCK "TODO unhandled udp address of size %d\n", (int)addrsize);
mockverbose("TODO unhandled udp address of size %d\n", (int)addrsize);
}
int _sock = -1;