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

tests/host: fixes and updates (#5537)

(LEAmDNS, broken pipe, non blocking accepted sockets, digitalRead)
This commit is contained in:
david gauchard
2018-12-22 07:03:11 +01:00
committed by Develo
parent 2388102a97
commit 228ad7ed75
8 changed files with 51 additions and 9 deletions

View File

@ -36,6 +36,8 @@
#include <sys/socket.h>
#include <poll.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#define int2pcb(x) ((tcp_pcb*)(intptr_t)(x))
#define pcb2int(x) ((int)(intptr_t)(x))
@ -50,7 +52,13 @@ int serverAccept (int srvsock)
n = sizeof(client);
if ((clisock = accept(srvsock, (struct sockaddr*)&client, &n)) == -1)
{
perror("accept()");
perror(MOCK "accept()");
exit(EXIT_FAILURE);
}
if (fcntl(clisock, F_SETFL, O_NONBLOCK) == -1)
{
fprintf(stderr, MOCK "ClientContext::accept: fcntl(O_NONBLOCK): %s\n", strerror(errno));
close(clisock);
exit(EXIT_FAILURE);
}
return clisock;