diff options
| author | Linus Nordberg <linus@nordberg.se> | 2014-11-04 12:45:39 +0100 |
|---|---|---|
| committer | Magnus Ahltorp <map@kth.se> | 2014-11-14 13:34:02 +0100 |
| commit | 124b79a8fed213c31db0360dd75c53fc415b5ab2 (patch) | |
| tree | 944d9a22a00be73a0f58b7232905553ecc22452e /src/ht.erl | |
| parent | 89a6ea31f0646f2a3ccbbca521b038d7ef811da3 (diff) | |
Invoke gen_server:call/2 via stacktrace:call/2.
stacktrace:call() logs an error if the gen_server:call() throws timeout.
Diffstat (limited to 'src/ht.erl')
| -rw-r--r-- | src/ht.erl | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -35,6 +35,7 @@ code_change/3]). -export([testing_get_state/0, print_tree/0, print_tree/1]). +-import(stacktrace, [call/2]). -include_lib("eunit/include/eunit.hrl"). -import(lists, [foreach/2, foldl/3, reverse/1]). @@ -51,30 +52,30 @@ start_link() -> start_link(NEntries) -> gen_server:start_link({local, ?MODULE}, ?MODULE, [NEntries], []). reset_tree(Arg) -> - gen_server:call(?MODULE, {reset_tree, Arg}). + call(?MODULE, {reset_tree, Arg}). stop() -> - gen_server:call(?MODULE, stop). + call(?MODULE, stop). size() -> - gen_server:call(?MODULE, size). + call(?MODULE, size). add(Hash) -> - gen_server:call(?MODULE, {add, Hash}). + call(?MODULE, {add, Hash}). root() -> - gen_server:call(?MODULE, root). + call(?MODULE, root). root(Version) -> - gen_server:call(?MODULE, {root, Version}). + call(?MODULE, {root, Version}). path(I, V) -> - gen_server:call(?MODULE, {path, I, V}). + call(?MODULE, {path, I, V}). consistency(V1, V2) -> - gen_server:call(?MODULE, {consistency, V1, V2}). + call(?MODULE, {consistency, V1, V2}). leaf_hash(Data) -> - gen_server:call(?MODULE, {leaf_hash, Data}). + call(?MODULE, {leaf_hash, Data}). %% Testing and debugging. testing_get_state() -> - gen_server:call(?MODULE, testing_get_state). + call(?MODULE, testing_get_state). print_tree() -> - gen_server:call(?MODULE, {print_tree, 4}). + call(?MODULE, {print_tree, 4}). print_tree(HashOutputLen) -> - gen_server:call(?MODULE, {print_tree, HashOutputLen}). + call(?MODULE, {print_tree, HashOutputLen}). %% gen_server callbacks init(Args) -> |
