Skip to content

Commit

Permalink
close
Browse files Browse the repository at this point in the history
  • Loading branch information
mabrek committed Sep 25, 2011
1 parent edce3fa commit 0505a27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pgsql.erl
Expand Up @@ -24,7 +24,7 @@ connect(Host, Username, Password, Opts) ->
gen_server:call(C, {connect, Host, Username, Password, Opts}).

close(C) when is_pid(C) ->
catch pgsql_connection:stop(C),
catch gen_server:call(C, stop),
ok.

get_parameter(C, Name) ->
Expand Down
6 changes: 5 additions & 1 deletion src/pgsql_sock.erl
Expand Up @@ -70,7 +70,11 @@ handle_call({connect, Host, Username, Password, Opts},
State2#state{handler = auth,
queue = queue:in(From, Queue),
async = Async},
Timeout}.
Timeout};

handle_call(stop, From, #state{queue = Queue} = State) ->
%% TODO flush queue
{stop, normal, ok, State}.

handle_cast(cancel, State = #state{backend = {Pid, Key}}) ->
{ok, {Addr, Port}} = inet:peername(State#state.sock),
Expand Down

0 comments on commit 0505a27

Please sign in to comment.