Permalink
Browse files

Adds cowboy_client:close/1.

  • Loading branch information...
1 parent 073950d commit 7158e5ed478c63cde28e2f143f0d429ac3155c3a @archaelus archaelus committed Jun 14, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/cowboy_client.erl
View
@@ -20,6 +20,7 @@
-export([init/1]).
-export([state/1]).
-export([transport/1]).
+-export([close/1]).
-export([connect/4]).
-export([raw_request/2]).
@@ -64,6 +65,11 @@ transport(#client{socket=undefined}) ->
transport(#client{transport=Transport, socket=Socket}) ->
{ok, Transport, Socket}.
+close(#client{socket=undefined}) ->
+ {error, notconnected};
+close(#client{transport=Transport, socket=Socket}) ->
+ Transport:close(Socket).
+
connect(Transport, Host, Port, Client)
when is_binary(Host) ->
connect(Transport, binary_to_list(Host), Port, Client);

0 comments on commit 7158e5e

Please sign in to comment.