From f86a52aae627c320659422780f4abc7f00203a19 Mon Sep 17 00:00:00 2001 From: vitalyster Date: Thu, 10 Oct 2019 20:09:43 +0300 Subject: [PATCH] socket: reuse socket parameters in addrinfo hints --- vlib/net/socket.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/net/socket.v b/vlib/net/socket.v index e986ccf5b7..7b18dab78a 100644 --- a/vlib/net/socket.v +++ b/vlib/net/socket.v @@ -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