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:
@ -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;
|
||||
|
Reference in New Issue
Block a user