[Unison-hackers] [unison-users] Address family not supported by protocol [socket()]
Samuel Thibault
samuel.thibault at ens-lyon.org
Sat Oct 1 11:14:53 EDT 2005
Samuel Thibault, le Sat 01 Oct 2005 17:03:54 +0200, a écrit :
> Jerome Vouillon, le Sat 01 Oct 2005 16:43:34 +0200, a écrit :
> > Hi Chuck,
> >
> > On Sat, Oct 01, 2005 at 10:30:16AM -0400, Chuck Farley wrote:
> > > I'm using unison-2.17.1-linux-text. Which I only just
> > > realized is a BETA. Damn never noticed that. Will
> > > try the latest stable.
> > [...]
> > > strace unison -socket 9876
> > [...]
> > > socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = -1
> >
> > So, this is due to the IPV6 support code which was recently added to
> > Unison. The latest stable version should not have this problem.
>
> Indeed.
>
> I'm afraid I missed the whole bug report, but I guess Chuck complains
> about a spurious warning to be emitted. That warning is a bit useless
> indeed, here is a patch:
Ah, sorry, that is not sufficient (Chuck really had an error, not a
warning), here is a better patch.
Index: src/remote.ml
===================================================================
--- src/remote.ml (révision 105)
+++ src/remote.ml (copie de travail)
@@ -819,17 +819,17 @@
port))
| ai::r ->
(* create a socket to talk to the remote host *)
- let socket = Unix.socket ai.Unix.ai_family ai.Unix.ai_socktype ai.Unix.ai_protocol in
- begin try
+ try
+ let socket = Unix.socket ai.Unix.ai_family ai.Unix.ai_socktype ai.Unix.ai_protocol in
Unix.connect socket ai.Unix.ai_addr;
initConnection socket socket
with
- Unix.Unix_error (_, _, reason) ->
- (Util.warn
- (Printf.sprintf
+ Unix.Unix_error (error, _, reason) ->
+ (if error != Unix.EAFNOSUPPORT then
+ Util.warn
+ (Printf.sprintf
"Can't connect to server (%s:%s): %s" host port reason);
loop r)
- end
in loop (Unix.getaddrinfo host port [ Unix.AI_SOCKTYPE Unix.SOCK_STREAM ]))
let buildShellConnection shell host userOpt portOpt rootName termInteract =
@@ -1126,9 +1126,9 @@
(Printf.sprintf "Can't find host (%s:%s)" host port))
| ai::r ->
(* Open a socket to listen for queries *)
- let socket = Unix.socket ai.Unix.ai_family ai.Unix.ai_socktype
- ai.Unix.ai_protocol in
- begin try
+ try
+ let socket = Unix.socket ai.Unix.ai_family ai.Unix.ai_socktype
+ ai.Unix.ai_protocol in
(* Allow reuse of local addresses for bind *)
Unix.setsockopt socket Unix.SO_REUSEADDR true;
(* Bind the socket to portnum on the local host *)
@@ -1137,13 +1137,14 @@
Unix.listen socket 1;
socket
with
- Unix.Unix_error (_, _, reason) ->
- (Util.warn
- (Printf.sprintf
- "Can't bind to host (%s:%s): %s" ai.Unix.ai_canonname port
- reason);
+ Unix.Unix_error (error, _, reason) ->
+ (if error != Unix.EAFNOSUPPORT then
+ Util.warn
+ (Printf.sprintf
+ "Can't bind to host (%s:%s): %s" ai.Unix.ai_canonname port
+ reason);
loop r)
- end in
+ in
let listening = loop (Unix.getaddrinfo host port [ Unix.AI_SOCKTYPE
Unix.SOCK_STREAM ; Unix.AI_PASSIVE ]) in
Util.msg "server started\n";
Regards,
Samuel
More information about the Unison-hackers
mailing list