diff options
Diffstat (limited to 'src/rabbit_cli.erl')
-rw-r--r-- | src/rabbit_cli.erl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rabbit_cli.erl b/src/rabbit_cli.erl index 4d44cc9e..cf7b6083 100644 --- a/src/rabbit_cli.erl +++ b/src/rabbit_cli.erl @@ -18,7 +18,7 @@ -include("rabbit_cli.hrl"). -export([main/3, start_distribution/0, start_distribution/1, - parse_arguments/4]). + parse_arguments/4, rpc_call/4]). %%---------------------------------------------------------------------------- @@ -38,6 +38,7 @@ -spec(parse_arguments/4 :: ([{atom(), [{string(), optdef()}]} | atom()], [{string(), optdef()}], string(), [string()]) -> parse_result()). +-spec(rpc_call/4 :: (node(), atom(), atom(), [any()]) -> any()). -endif. @@ -204,3 +205,13 @@ print_error(Format, Args) -> fmt_stderr("Error: " ++ Format, Args). print_badrpc_diagnostics(Nodes) -> fmt_stderr(rabbit_nodes:diagnostics(Nodes), []). +%% If the server we are talking to has non-standard net_ticktime, and +%% our connection lasts a while, we could get disconnected because of +%% a timeout unless we set our ticktime to be the same. So let's do +%% that. +rpc_call(Node, Mod, Fun, Args) -> + case rpc:call(Node, net_kernel, get_net_ticktime, [], ?RPC_TIMEOUT) of + {badrpc, _} = E -> E; + Time -> net_kernel:set_net_ticktime(Time, 0), + rpc:call(Node, Mod, Fun, Args, ?RPC_TIMEOUT) + end. |