socket: fix sizeof

pull/2882/head
Alexander Medvednikov 2019-11-25 06:23:09 +03:00
parent a4ab7b14c1
commit feacc2441f
1 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ pub fn new_socket(family int, _type int, proto int) ?Socket {
one:=1 one:=1
// This is needed so that there are no problems with reusing the // This is needed so that there are no problems with reusing the
// same port after the application exits. // same port after the application exits.
C.setsockopt(sockfd, C.SOL_SOCKET, C.SO_REUSEADDR, &one, 4)//sizeof(int)) C.setsockopt(sockfd, C.SOL_SOCKET, C.SO_REUSEADDR, &one, sizeof(int))
if sockfd == 0 { if sockfd == 0 {
return error('net.socket: failed') return error('net.socket: failed')
} }
@ -79,7 +79,7 @@ pub fn socket_udp() ?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, sizeof(int)) res := C.setsockopt(s.sockfd, level, optname, optvalue, sizeof(&int))
if res < 0 { if res < 0 {
return error('net.setsocketopt: failed with $res') return error('net.setsocketopt: failed with $res')
} }