10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 07:02:14 +02: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 =
try
ZMQ.Socket.bind socket address
with
| Unix.Unix_error (_, message, f) ->
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
let rec loop = function
| 0 -> failwith @@ Printf.sprintf
"Unable to bind the %s socket : %s "
socket_type address
| -1 -> ();
| i ->
try
ZMQ.Socket.bind socket address;
loop (-1)
with
| Unix.Unix_error _ -> (Time.pause @@ Time.Span.of_float 1. ; loop (i-1) )
| other_exception -> raise other_exception
in loop 10
let hostname = lazy (

View File

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