aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch_tcp.erl
diff options
context:
space:
mode:
authorStéphane Wirtel <[email protected]>2014-09-02 18:30:04 +0200
committerStéphane Wirtel <[email protected]>2014-09-02 18:30:04 +0200
commit9176df9eb5a10c3aaee0dd4bc424f9453c441c9d (patch)
treea698cb004409227bf44e464b7af05ccbd627db9f /src/ranch_tcp.erl
parentadf1822defc2b7cfdc7aca112adabfa1d614043c (diff)
downloadranch-9176df9eb5a10c3aaee0dd4bc424f9453c441c9d.tar.gz
ranch-9176df9eb5a10c3aaee0dd4bc424f9453c441c9d.tar.bz2
ranch-9176df9eb5a10c3aaee0dd4bc424f9453c441c9d.zip
Add Transport:secure/0
Currently Ranch checks if a connection is secure by checking if its name is 'ssl'. This isn't a very modular solution, adding an API function that returns whether a connection is secure.
Diffstat (limited to 'src/ranch_tcp.erl')
-rw-r--r--src/ranch_tcp.erl5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ranch_tcp.erl b/src/ranch_tcp.erl
index 8e24d3c..e3bcf81 100644
--- a/src/ranch_tcp.erl
+++ b/src/ranch_tcp.erl
@@ -16,6 +16,7 @@
-behaviour(ranch_transport).
-export([name/0]).
+-export([secure/0]).
-export([messages/0]).
-export([listen/1]).
-export([accept/2]).
@@ -47,6 +48,10 @@
name() -> tcp.
+-spec secure() -> boolean().
+secure() ->
+ false.
+
messages() -> {tcp, tcp_closed, tcp_error}.
-spec listen(opts()) -> {ok, inet:socket()} | {error, atom()}.