mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: define missing C fn args & check C & JS args (#8770)
This commit is contained in:
@ -157,7 +157,7 @@ pub fn (c &TcpConn) peer_ip() ?string {
|
||||
peeraddr := C.sockaddr_in{}
|
||||
speeraddr := sizeof(peeraddr)
|
||||
socket_error(C.getpeername(c.sock.handle, unsafe { &C.sockaddr(&peeraddr) }, &speeraddr)) ?
|
||||
cstr := charptr(C.inet_ntop(C.AF_INET, &peeraddr.sin_addr, buf, sizeof(buf)))
|
||||
cstr := charptr(C.inet_ntop(SocketFamily.inet, &peeraddr.sin_addr, buf, sizeof(buf)))
|
||||
if cstr == 0 {
|
||||
return error('net.peer_ip: inet_ntop failed')
|
||||
}
|
||||
@ -264,7 +264,7 @@ fn new_tcp_socket() ?TcpSocket {
|
||||
// s.set_option_bool(.reuse_addr, true)?
|
||||
s.set_option_int(.reuse_addr, 1) ?
|
||||
$if windows {
|
||||
t := true
|
||||
t := u32(1) // true
|
||||
socket_error(C.ioctlsocket(sockfd, fionbio, &t)) ?
|
||||
} $else {
|
||||
socket_error(C.fcntl(sockfd, C.F_SETFL, C.fcntl(sockfd, C.F_GETFL) | C.O_NONBLOCK)) ?
|
||||
@ -279,7 +279,7 @@ fn tcp_socket_from_handle(sockfd int) ?TcpSocket {
|
||||
// s.set_option_bool(.reuse_addr, true)?
|
||||
s.set_option_int(.reuse_addr, 1) ?
|
||||
$if windows {
|
||||
t := true
|
||||
t := u32(1) // true
|
||||
socket_error(C.ioctlsocket(sockfd, fionbio, &t)) ?
|
||||
} $else {
|
||||
socket_error(C.fcntl(sockfd, C.F_SETFL, C.fcntl(sockfd, C.F_GETFL) | C.O_NONBLOCK)) ?
|
||||
|
Reference in New Issue
Block a user