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

net: add a net.tcp_socket_from_handle_raw function (#16167)

This commit is contained in:
Wertzui123 2022-10-23 21:21:46 +02:00 committed by GitHub
parent 158fd5c249
commit 340611c298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -398,6 +398,17 @@ fn tcp_socket_from_handle(sockfd int) !TcpSocket {
return s
}
// tcp_socket_from_handle_raw is similar to tcp_socket_from_handle, but it does not modify any socket options
pub fn tcp_socket_from_handle_raw(sockfd int) TcpSocket {
mut s := TcpSocket{
handle: sockfd
}
$if trace_tcp ? {
eprintln(' tcp_socket_from_handle_raw | s.handle: ${s.handle:6}')
}
return s
}
pub fn (mut s TcpSocket) set_option_bool(opt SocketOption, value bool) ! {
// TODO reenable when this `in` operation works again
// if opt !in opts_can_set {