P2p: force IPv6 in discovery

This commit is contained in:
Vincent Bernardoff 2016-11-15 16:27:55 +01:00 committed by Grégoire Henry
parent 3c55c72abf
commit f7e73a6dc5

View File

@ -638,7 +638,9 @@ module Make (P: PARAMS) = struct
catch catch
(fun () -> (fun () ->
let ipaddr = Ipaddr_unix.of_inet_addr addr in let ipaddr = Ipaddr_unix.of_inet_addr addr in
let socket = LU.(socket (match ipaddr with Ipaddr.V4 _ -> PF_INET | V6 _ -> PF_INET6) SOCK_STREAM 0) in let ipaddr = Ipaddr.(match ipaddr with V4 addr -> V6 (v6_of_v4 addr) | _ -> ipaddr) in
let addr = Ipaddr_unix.to_inet_addr ipaddr in
let socket = LU.(socket PF_INET6 SOCK_STREAM 0) in
LU.connect socket LU.(ADDR_INET (addr, port)) >>= fun () -> LU.connect socket LU.(ADDR_INET (addr, port)) >>= fun () ->
callback ipaddr port socket >>= fun () -> callback ipaddr port socket >>= fun () ->
return ()) return ())