aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-04-12 16:27:44 +0200
committerLoïc Hoguin <[email protected]>2011-04-12 16:27:44 +0200
commitbc99200baef9f4ccb2bcf7d075aecabd9d084e8f (patch)
tree76b059ab501008b29dc8848b5eb1391958fc7023 /src
parentaab91c044b5eeabc38556c2810e9861c297fbcb1 (diff)
downloadcowboy-bc99200baef9f4ccb2bcf7d075aecabd9d084e8f.tar.gz
cowboy-bc99200baef9f4ccb2bcf7d075aecabd9d084e8f.tar.bz2
cowboy-bc99200baef9f4ccb2bcf7d075aecabd9d084e8f.zip
Add a Transport:messages/0 function to obtain the atoms sent in active mode.
That way we can support active mode without having to hardcode the atoms for each transports available.
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_ssl_transport.erl5
-rw-r--r--src/cowboy_tcp_transport.erl9
2 files changed, 11 insertions, 3 deletions
diff --git a/src/cowboy_ssl_transport.erl b/src/cowboy_ssl_transport.erl
index ec0f8c8..4db2008 100644
--- a/src/cowboy_ssl_transport.erl
+++ b/src/cowboy_ssl_transport.erl
@@ -13,7 +13,7 @@
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-module(cowboy_ssl_transport).
--export([name/0, listen/1, accept/1, recv/3, send/2, setopts/2,
+-export([name/0, messages/0, listen/1, accept/1, recv/3, send/2, setopts/2,
controlling_process/2, peername/1, close/1]). %% API.
-include("include/types.hrl").
@@ -23,6 +23,9 @@
-spec name() -> ssl.
name() -> ssl.
+-spec messages() -> {ssl, ssl_closed, ssl_error}.
+messages() -> {ssl, ssl_closed, ssl_error}.
+
-spec listen([{port, Port::port_number()} | {certfile, CertPath::string()}
| {keyfile, KeyPath::string()} | {password, Password::string()}])
-> {ok, LSocket::socket()} | {error, Reason::posix()}.
diff --git a/src/cowboy_tcp_transport.erl b/src/cowboy_tcp_transport.erl
index 5bc80fe..c1aeabc 100644
--- a/src/cowboy_tcp_transport.erl
+++ b/src/cowboy_tcp_transport.erl
@@ -13,14 +13,19 @@
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-module(cowboy_tcp_transport).
--export([name/0, listen/1, accept/1, recv/3, send/2, setopts/2,
- controlling_process/2, peername/1, close/1]).
+-export([name/0, messages/0, listen/1, accept/1, recv/3, send/2, setopts/2,
+ controlling_process/2, peername/1, close/1]). %% API.
-include("include/types.hrl").
+%% API.
+
-spec name() -> tcp.
name() -> tcp.
+-spec messages() -> {tcp, tcp_closed, tcp_error}.
+messages() -> {tcp, tcp_closed, tcp_error}.
+
-spec listen([{port, Port::port_number()}])
-> {ok, LSocket::socket()} | {error, Reason::posix()}.
listen(Opts) ->