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

net: support blocking sockets in TcpSocket.connect (#14849)

This commit is contained in:
WoodyAtHome
2022-06-27 10:01:55 +02:00
committed by GitHub
parent ef7f9779a3
commit 34517c340d

View File

@ -379,6 +379,7 @@ const (
)
fn (mut s TcpSocket) connect(a Addr) ? {
$if !net_blocking_sockets ? {
res := C.connect(s.handle, voidptr(&a), a.len())
if res == 0 {
return
@ -410,4 +411,7 @@ fn (mut s TcpSocket) connect(a Addr) ? {
// otherwise we timed out
return err_connect_timed_out
} $else {
socket_error(C.connect(s.handle, voidptr(&a), a.len()))?
}
}