mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: require calling optfn() ?
/ optfn() or {...}
for fn optfn() ? {}
This commit is contained in:
@ -33,8 +33,8 @@ pub fn dial_udp(laddr string, raddr string) ?&UdpConn {
|
||||
}
|
||||
return &UdpConn{
|
||||
sock: sock
|
||||
read_timeout: udp_default_read_timeout
|
||||
write_timeout: udp_default_write_timeout
|
||||
read_timeout: net.udp_default_read_timeout
|
||||
write_timeout: net.udp_default_write_timeout
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,8 +162,8 @@ pub fn listen_udp(port int) ?&UdpConn {
|
||||
s := new_udp_socket(port) ?
|
||||
return &UdpConn{
|
||||
sock: s
|
||||
read_timeout: udp_default_read_timeout
|
||||
write_timeout: udp_default_write_timeout
|
||||
read_timeout: net.udp_default_read_timeout
|
||||
write_timeout: net.udp_default_write_timeout
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ fn new_udp_socket(local_port int) ?&UdpSocket {
|
||||
t := true
|
||||
socket_error(C.ioctlsocket(sockfd, fionbio, &t)) ?
|
||||
} $else {
|
||||
socket_error(C.fcntl(sockfd, C.F_SETFD, C.O_NONBLOCK))
|
||||
socket_error(C.fcntl(sockfd, C.F_SETFD, C.O_NONBLOCK)) ?
|
||||
}
|
||||
// In UDP we always have to bind to a port
|
||||
validate_port(local_port) ?
|
||||
|
Reference in New Issue
Block a user