socket: reuse socket parameters in addrinfo hints

pull/2293/head
vitalyster 2019-10-10 20:09:43 +03:00 committed by Alexander Medvednikov
parent e61dce6441
commit f86a52aae6
1 changed files with 3 additions and 3 deletions

View File

@ -148,10 +148,10 @@ pub fn (s Socket) accept() ?Socket {
// connect to given addrress and port // connect to given addrress and port
pub fn (s Socket) connect(address string, port int) ?int { pub fn (s Socket) connect(address string, port int) ?int {
mut hints := C.addrinfo{} mut hints := C.addrinfo{}
hints.ai_family = C.AF_UNSPEC hints.ai_family = s.family
hints.ai_socktype = C.SOCK_STREAM hints.ai_socktype = s._type
hints.ai_flags = C.AI_PASSIVE hints.ai_flags = C.AI_PASSIVE
hints.ai_protocol = 0 hints.ai_protocol = s.proto
hints.ai_addrlen = 0 hints.ai_addrlen = 0
hints.ai_canonname = C.NULL hints.ai_canonname = C.NULL
hints.ai_addr = C.NULL hints.ai_addr = C.NULL