mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-23 04:43:50 +01:00
Fixed #152
This commit is contained in:
parent
5dd55ffab9
commit
46e7005e7b
@ -32,14 +32,19 @@ let zmq_context =
|
||||
|
||||
|
||||
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
|
||||
ZMQ.Socket.bind socket address
|
||||
ZMQ.Socket.bind socket address;
|
||||
loop (-1)
|
||||
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
|
||||
| Unix.Unix_error _ -> (Time.pause @@ Time.Span.of_float 1. ; loop (i-1) )
|
||||
| other_exception -> raise other_exception
|
||||
in loop 10
|
||||
|
||||
|
||||
let hostname = lazy (
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user