1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net: add -d trace_tcp support for more TcpConn methods; support again -d net_blocking_sockets too

This commit is contained in:
Delyan Angelov
2021-08-27 13:10:34 +03:00
parent a85467eb0f
commit c954c2834a
2 changed files with 56 additions and 16 deletions

View File

@@ -213,12 +213,14 @@ fn new_udp_socket(local_addr Addr) ?&UdpSocket {
s.set_dualstack(true) ?
}
// NOTE: refer to comments in tcp.v
$if windows {
t := u32(1) // true
socket_error(C.ioctlsocket(sockfd, fionbio, &t)) ?
} $else {
socket_error(C.fcntl(sockfd, C.F_SETFD, C.O_NONBLOCK)) ?
$if !net_blocking_sockets ? {
// NOTE: refer to comments in tcp.v
$if windows {
t := u32(1) // true
socket_error(C.ioctlsocket(sockfd, fionbio, &t)) ?
} $else {
socket_error(C.fcntl(sockfd, C.F_SETFD, C.O_NONBLOCK)) ?
}
}
// cast to the correct type