10
0
mirror of https://github.com/LCPQ/quantum_package synced 2025-01-10 21:18:29 +01:00
This commit is contained in:
Anthony Scemama 2016-03-04 12:11:38 +01:00
parent 5dd55ffab9
commit 46e7005e7b
2 changed files with 15 additions and 10 deletions

View File

@ -32,14 +32,19 @@ let zmq_context =
let bind_socket ~socket_type ~socket ~address = let bind_socket ~socket_type ~socket ~address =
let rec loop = function
| 0 -> failwith @@ Printf.sprintf
"Unable to bind the %s socket : %s "
socket_type address
| -1 -> ();
| i ->
try try
ZMQ.Socket.bind socket address ZMQ.Socket.bind socket address;
loop (-1)
with with
| Unix.Unix_error (_, message, f) -> | Unix.Unix_error _ -> (Time.pause @@ Time.Span.of_float 1. ; loop (i-1) )
failwith @@ Printf.sprintf
"\n%s\nUnable to bind the %s socket :\n %s\n%s"
f socket_type address message
| other_exception -> raise other_exception | other_exception -> raise other_exception
in loop 10
let hostname = lazy ( let hostname = lazy (

View File

@ -32,12 +32,12 @@ let run ~master exe ezfio_file =
let address = let address =
Printf.sprintf "tcp://%s:%d" (Lazy.force TaskServer.ip_address) (port_number+i) Printf.sprintf "tcp://%s:%d" (Lazy.force TaskServer.ip_address) (port_number+i)
in in
TaskServer.bind_socket "REP" dummy_socket address ; ZMQ.Socket.bind dummy_socket address;
ZMQ.Socket.unbind dummy_socket address; ZMQ.Socket.unbind dummy_socket address;
); );
port_number port_number
with with
| Failure _ -> try_new_port (port_number+100) | Unix.Unix_error _ -> try_new_port (port_number+100)
in in
let result = let result =
try_new_port 41279 try_new_port 41279