sks-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3] Use Unix.domain_of_sockaddr instead of hardcoded PF_INET or PF


From: Kim Minh Kaplan
Subject: [PATCH 3] Use Unix.domain_of_sockaddr instead of hardcoded PF_INET or PF_UNIX (was: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix)
Date: Wed, 25 Mar 2009 14:04:58 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Use Unix.domain_of_sockaddr instead of hardcoded PF_INET or PF_UNIX.
Connections are thus independant of the underlying protocol (Unix,
IPv4 or IPv6).

Kim Minh.

diff -r 38b920ada3e2 -r 0b3ca8c14f6f eventloop.ml
--- a/eventloop.ml      Wed Mar 25 12:14:08 2009 +0000
+++ b/eventloop.ml      Wed Mar 25 13:37:28 2009 +0000
@@ -122,9 +122,7 @@
 let create_sock addr = 
   try
     let domain = 
-      match addr with 
-         ADDR_UNIX _ -> PF_UNIX 
-       | ADDR_INET (_,_) -> PF_INET in
+      Unix.domain_of_sockaddr addr in
     let sock =
       socket ~domain ~kind:SOCK_STREAM ~protocol:0 in
     setsockopt sock SO_REUSEADDR true;
diff -r 38b920ada3e2 -r 0b3ca8c14f6f reconCS.ml
--- a/reconCS.ml        Wed Mar 25 12:14:08 2009 +0000
+++ b/reconCS.ml        Wed Mar 25 13:37:28 2009 +0000
@@ -132,7 +132,7 @@
 let connect tree ~filters ~partner ~self = 
   (* TODO: change the following to depend on the address type *)
   let s = Unix.socket 
-           ~domain:Unix.PF_INET 
+           ~domain:(Unix.domain_of_sockaddr partner)
            ~kind:Unix.SOCK_STREAM 
            ~protocol:0 
   in
diff -r 38b920ada3e2 -r 0b3ca8c14f6f reconComm.ml
--- a/reconComm.ml      Wed Mar 25 12:14:08 2009 +0000
+++ b/reconComm.ml      Wed Mar 25 13:37:28 2009 +0000
@@ -31,7 +31,7 @@
 (** send DbMessages message and wait for response *)
 let send_dbmsg msg = 
   let s = Unix.socket 
-           ~domain:Unix.PF_UNIX 
+           ~domain:(Unix.domain_of_sockaddr db_command_addr)
            ~kind:Unix.SOCK_STREAM 
            ~protocol:0 in
   protect ~f:(fun () ->
@@ -48,7 +48,7 @@
 (** send DbMessages message, don't wait for response *)
 let send_dbmsg_noreply msg = 
   let s = Unix.socket 
-           ~domain:Unix.PF_UNIX
+           ~domain:(Unix.domain_of_sockaddr db_command_addr)
            ~kind:Unix.SOCK_STREAM 
            ~protocol:0 in
   protect ~f:(fun () ->
@@ -69,7 +69,7 @@
 
 let get_keystrings_via_http addr hashes = 
   let s = Unix.socket 
-           ~domain:Unix.PF_INET 
+           ~domain:(Unix.domain_of_sockaddr addr)
            ~kind:Unix.SOCK_STREAM 
            ~protocol:0  in
   protect ~f:(fun () -> 
diff -r 38b920ada3e2 -r 0b3ca8c14f6f script.ml
--- a/script.ml Wed Mar 25 12:14:08 2009 +0000
+++ b/script.ml Wed Mar 25 13:37:28 2009 +0000
@@ -59,7 +59,7 @@
 
 let get_keystrings_via_http addr hashes = 
   let s = Unix.socket 
-           ~domain:Unix.PF_INET 
+           ~domain:(Unix.domain_of_sockaddr addr)
            ~kind:Unix.SOCK_STREAM 
            ~protocol:0  in
   let () = Unix.connect s ~addr in
@@ -87,7 +87,7 @@
 
 let test addr hashes = 
   let s = Unix.socket 
-           ~domain:Unix.PF_INET 
+           ~domain:(Unix.domain_of_sockaddr addr)
            ~kind:Unix.SOCK_STREAM 
            ~protocol:0  in
   let () = Unix.connect s ~addr in
diff -r 38b920ada3e2 -r 0b3ca8c14f6f sks_do.ml
--- a/sks_do.ml Wed Mar 25 12:14:08 2009 +0000
+++ b/sks_do.ml Wed Mar 25 13:37:28 2009 +0000
@@ -36,7 +36,7 @@
 
 let send_dbmsg msg = 
   let s = Unix.socket 
-           ~domain:Unix.PF_UNIX 
+           ~domain:(Unix.domain_of_sockaddr db_command_addr)
            ~kind:Unix.SOCK_STREAM 
            ~protocol:0 in
   protect ~f:(fun () ->
diff -r 38b920ada3e2 -r 0b3ca8c14f6f tester.ml
--- a/tester.ml Wed Mar 25 12:14:08 2009 +0000
+++ b/tester.ml Wed Mar 25 13:37:28 2009 +0000
@@ -36,7 +36,7 @@
 
 let send_msg addr msg = 
   let s = Unix.socket 
-           ~domain:Unix.PF_UNIX 
+           ~domain:(Unix.domain_of_sockaddr addr)
            ~kind:Unix.SOCK_STREAM 
            ~protocol:0 in
   protect ~f:( fun () -> 
@@ -52,7 +52,7 @@
 
 let send_msg_noreply addr msg = 
   let s = Unix.socket 
-           ~domain:Unix.PF_UNIX 
+           ~domain:(Unix.domain_of_sockaddr addr)
            ~kind:Unix.SOCK_STREAM 
            ~protocol:0 in
   protect ~f:(fun () -> 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]