create correct socket family given ip addr type

This commit is contained in:
Vincent Bernardoff 2016-10-10 19:11:59 +02:00
parent 8e02ddb1f6
commit 7dfb68b50a

View File

@ -762,7 +762,7 @@ let bootstrap config limits =
| _, [] -> return false (* we didn't manage to contact enough peers *)
| nb, ((addr, port), gid, source) :: tl ->
(* we try to open a connection *)
let socket = LU.(socket PF_INET6 SOCK_STREAM 0) in
let socket = LU.(socket (match addr with Ipaddr.V4 _ -> PF_INET | V6 _ -> PF_INET6) SOCK_STREAM 0) in
let uaddr = Ipaddr_unix.to_inet_addr addr in
catch
(fun () ->