setsockopt arg optvalue supposed to be ptr

pull/937/head
S-YOU 2019-07-03 00:16:32 +09:00 committed by Alexander Medvednikov
parent 1bbf3a3a0c
commit 53e439bc99
1 changed files with 2 additions and 2 deletions

View File

@ -65,7 +65,7 @@ pub fn socket(family int, _type int, proto int) Socket {
} }
// set socket options // set socket options
pub fn (s Socket) setsockopt(level int, optname int, optvalue int) int { pub fn (s Socket) setsockopt(level int, optname int, optvalue *int) int {
res := C.setsockopt(s.sockfd, level, optname, optvalue, C.sizeof(optvalue)) res := C.setsockopt(s.sockfd, level, optname, optvalue, C.sizeof(optvalue))
return res return res
} }
@ -131,7 +131,7 @@ pub fn (s Socket) connect(address string, port int) int {
hints.ai_family = AF_UNSPEC hints.ai_family = AF_UNSPEC
hints.ai_socktype = SOCK_STREAM hints.ai_socktype = SOCK_STREAM
hints.ai_flags = AI_PASSIVE hints.ai_flags = AI_PASSIVE
info := &C.addrinfo{!} info := &C.addrinfo{!}
sport := '$port' sport := '$port'
info_res := C.getaddrinfo(address.cstr(), sport.cstr(), &hints, &info) info_res := C.getaddrinfo(address.cstr(), sport.cstr(), &hints, &info)