Skip to content

Commit

Permalink
better disconnect procedure, thanks zabrane
Browse files Browse the repository at this point in the history
  • Loading branch information
joewilliams committed Jun 28, 2010
1 parent ab4bccc commit 1fc2c4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions NOTICES
Expand Up @@ -6,3 +6,4 @@ Contributors and Copyright holders:

* Copyright 2009, Joe Williams <joe@joetify.com>
* Copyright 2009, Nick Gerakines <nick@gerakines.net>
* Copyright 2010, Zabrane Mikael <zabrane3@gmail.com>
9 changes: 4 additions & 5 deletions src/merle.erl
Expand Up @@ -238,8 +238,7 @@ connect(Host, Port) ->

%% @doc disconnect from memcached
disconnect() ->
gen_server2:call(?SERVER, {stop}),
ok.
gen_server2:call(?SERVER, stop).

%% @private
start_link(Host, Port) ->
Expand All @@ -249,9 +248,6 @@ start_link(Host, Port) ->
init([Host, Port]) ->
gen_tcp:connect(Host, Port, ?TCP_OPTS).

handle_call({stop}, _From, Socket) ->
{stop, requested_disconnect, Socket};

handle_call({stats}, _From, Socket) ->
Reply = send_generic_cmd(Socket, iolist_to_binary([<<"stats">>])),
{reply, Reply, Socket};
Expand Down Expand Up @@ -342,6 +338,9 @@ handle_call({cas, {Key, Flag, ExpTime, CasUniq, Value}}, _From, Socket) ->
{reply, Reply, Socket}.

%% @private
handle_cast(stop, State) ->
{stop, normal, State};

handle_cast(_Msg, State) -> {noreply, State}.

%% @private
Expand Down

0 comments on commit 1fc2c4f

Please sign in to comment.