Modem: Close pico socket when native one returns an error.
Linux build fix.
This commit is contained in:
parent
be8bae0547
commit
1320ce5949
|
@ -22,6 +22,7 @@ typedef int sock_t;
|
|||
#define L_EWOULDBLOCK EWOULDBLOCK
|
||||
#define L_EAGAIN EAGAIN
|
||||
#define get_last_error() (errno)
|
||||
#define INVALID_SOCKET (-1)
|
||||
#else
|
||||
typedef SOCKET sock_t;
|
||||
#define VALID(s) ((s) != INVALID_SOCKET)
|
||||
|
|
|
@ -183,7 +183,13 @@ static void tcp_callback(uint16_t ev, struct pico_socket *s)
|
|||
r = pico_socket_read(it->first, buf, sizeof(buf));
|
||||
if (r > 0) {
|
||||
if (send(it->second, buf, r, 0) < r)
|
||||
{
|
||||
perror("tcp_callback send");
|
||||
closesocket(it->second);
|
||||
pico_socket_close(it->first);
|
||||
tcp_sockets.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue