diff options
author | Andrew Thompson <[email protected]> | 2012-04-06 13:14:54 -0400 |
---|---|---|
committer | Andrew Thompson <[email protected]> | 2012-04-06 13:24:02 -0400 |
commit | 06a2d636bce7a0494b960eae574fc092d25fcd7a (patch) | |
tree | cfbf0b5a432ca68cd3688a4bab7263da03f35c4e /src/cowboy_ssl_transport.erl | |
parent | 95e05d822f46e791a919f4e966879b4827989669 (diff) | |
download | cowboy-06a2d636bce7a0494b960eae574fc092d25fcd7a.tar.gz cowboy-06a2d636bce7a0494b960eae574fc092d25fcd7a.tar.bz2 cowboy-06a2d636bce7a0494b960eae574fc092d25fcd7a.zip |
Add sockname/1 to the TCP and SSL transports
Diffstat (limited to 'src/cowboy_ssl_transport.erl')
-rw-r--r-- | src/cowboy_ssl_transport.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cowboy_ssl_transport.erl b/src/cowboy_ssl_transport.erl index 8074209..3b130f0 100644 --- a/src/cowboy_ssl_transport.erl +++ b/src/cowboy_ssl_transport.erl @@ -24,7 +24,7 @@ %% @see ssl -module(cowboy_ssl_transport). -export([name/0, messages/0, listen/1, accept/2, recv/3, send/2, setopts/2, - controlling_process/2, peername/1, close/1]). + controlling_process/2, peername/1, close/1, sockname/1]). %% @doc Name of this transport API, <em>ssl</em>. -spec name() -> ssl. @@ -140,6 +140,13 @@ peername(Socket) -> close(Socket) -> ssl:close(Socket). +%% @doc Get the local address and port of a socket +%% @see ssl:sockname/1 +-spec sockname(ssl:sslsocket()) + -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}. +sockname(Socket) -> + ssl:sockname(Socket). + %% Internal. -spec require(list(module())) -> ok. |