Properly stop the repo and revwalk servers

Return the 4-tuple when asked to stop instead of the 3-tuple so we do
indicate the stop was normal.
This commit is contained in:
Carlos Martín Nieto
2013-04-10 20:11:07 +02:00
parent d0034b1142
commit 353995a2da
4 changed files with 16 additions and 8 deletions

View File

@@ -116,7 +116,7 @@ handle_call({lookup_object, Oid}, _From, State = #state{handle=Handle}) ->
Reply = geef:object_lookup(Handle, Oid),
{reply, Reply, State};
handle_call(stop, _From, State) ->
{stop, normal, State};
{stop, normal, ok, State};
handle_call(revwalk, _From, State = #state{handle=Handle}) ->
Reply = handle_revwalk(Handle),
{reply, Reply, State};

View File

@@ -12,7 +12,7 @@
%% API
-export([start_link/1]).
-export([push/2, hide/2, next/1, sorting/2]).
-export([push/2, hide/2, next/1, sorting/2, stop/1]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
@@ -49,6 +49,10 @@ sorting(Pid, Opt) when is_atom(Opt) ->
next(Pid) ->
gen_server:call(Pid, next).
%% @doc Stop the revwalk server
stop(Pid) ->
gen_server:call(Pid, stop).
%%--------------------------------------------------------------------
%% @doc
%% Starts the server
@@ -79,7 +83,9 @@ handle_call({hide, Oid}, _From, State = #state{handle=Handle}) ->
{reply, Reply, State};
handle_call(next, _From, State = #state{handle=Handle}) ->
Reply = handle_next(Handle),
{reply, Reply, State}.
{reply, Reply, State};
handle_call(stop, _From, State) ->
{stop, normal, ok, State}.
%% @private
handle_cast(_Msg, State) ->