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

socket: reuse socket parameters in addrinfo hints

This commit is contained in:
vitalyster 2019-10-10 20:09:43 +03:00 committed by Alexander Medvednikov
parent e61dce6441
commit f86a52aae6

View File

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