mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2024-11-06 22:23:39 +01:00
Deterministic ZMQ ports
This commit is contained in:
parent
9b34e07283
commit
591f0306ea
@ -71,8 +71,6 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
(*
|
|
||||||
(** Checks if the port is already open (not working properly yet) *)
|
|
||||||
let check_port n =
|
let check_port n =
|
||||||
let adress_prefix =
|
let adress_prefix =
|
||||||
"tcp://*:"
|
"tcp://*:"
|
||||||
@ -87,7 +85,9 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
in
|
in
|
||||||
let result =
|
let result =
|
||||||
try
|
try
|
||||||
(ZMQ.Socket.bind socket address; accu );
|
ZMQ.Socket.bind socket address;
|
||||||
|
ZMQ.Socket.unbind socket address;
|
||||||
|
accu;
|
||||||
with
|
with
|
||||||
| _ -> false;
|
| _ -> false;
|
||||||
in
|
in
|
||||||
@ -100,22 +100,18 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
else
|
else
|
||||||
`Unavailable
|
`Unavailable
|
||||||
in
|
in
|
||||||
*)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(** Random port number between 49152 and 65535 *)
|
(** Random port number between 49152 and 65535 *)
|
||||||
let port =
|
let port =
|
||||||
let newport =
|
let newport =
|
||||||
(* ref (49152 + (Random.int 16383)) *)
|
ref 10000
|
||||||
ref ( 1024 + (Random.int (49151-1024)))
|
|
||||||
in
|
in
|
||||||
(*
|
|
||||||
while ((check_port !newport) = `Unavailable)
|
while ((check_port !newport) = `Unavailable)
|
||||||
do
|
do
|
||||||
newport := 49152 + (Random.int 16383)
|
newport := !newport + 100
|
||||||
done;
|
done;
|
||||||
*)
|
|
||||||
!newport
|
!newport
|
||||||
in
|
in
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user