mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 13:36:06 +03:00
Use recv on windows and read for the others
This commit is contained in:
parent
ae8f7ca321
commit
b4bcbe2b21
@ -361,7 +361,13 @@ read_tun(int tun_fd, char *buf, size_t len)
|
|||||||
/* FreeBSD/Darwin/NetBSD has no header */
|
/* FreeBSD/Darwin/NetBSD has no header */
|
||||||
int bytes;
|
int bytes;
|
||||||
memset(buf, 0, 4);
|
memset(buf, 0, 4);
|
||||||
|
#ifdef WINDOWS32
|
||||||
|
/* Windows needs recv() since it is local UDP socket */
|
||||||
|
bytes = recv(tun_fd, buf + 4, len - 4, 0);
|
||||||
|
#else
|
||||||
|
/* The other need read() because fd is not a socket */
|
||||||
bytes = read(tun_fd, buf + 4, len - 4);
|
bytes = read(tun_fd, buf + 4, len - 4);
|
||||||
|
#endif /*WINDOWS32*/
|
||||||
if (bytes < 0) {
|
if (bytes < 0) {
|
||||||
return bytes;
|
return bytes;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user