0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

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.
This commit is contained in:
Loïc Hoguin 2011-04-12 16:27:44 +02:00
parent aab91c044b
commit bc99200bae
2 changed files with 11 additions and 3 deletions

View file

@ -13,7 +13,7 @@
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-module(cowboy_ssl_transport). -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. controlling_process/2, peername/1, close/1]). %% API.
-include("include/types.hrl"). -include("include/types.hrl").
@ -23,6 +23,9 @@
-spec name() -> ssl. -spec name() -> ssl.
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()} -spec listen([{port, Port::port_number()} | {certfile, CertPath::string()}
| {keyfile, KeyPath::string()} | {password, Password::string()}]) | {keyfile, KeyPath::string()} | {password, Password::string()}])
-> {ok, LSocket::socket()} | {error, Reason::posix()}. -> {ok, LSocket::socket()} | {error, Reason::posix()}.

View file

@ -13,14 +13,19 @@
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-module(cowboy_tcp_transport). -module(cowboy_tcp_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]). controlling_process/2, peername/1, close/1]). %% API.
-include("include/types.hrl"). -include("include/types.hrl").
%% API.
-spec name() -> tcp. -spec name() -> tcp.
name() -> tcp. name() -> tcp.
-spec messages() -> {tcp, tcp_closed, tcp_error}.
messages() -> {tcp, tcp_closed, tcp_error}.
-spec listen([{port, Port::port_number()}]) -spec listen([{port, Port::port_number()}])
-> {ok, LSocket::socket()} | {error, Reason::posix()}. -> {ok, LSocket::socket()} | {error, Reason::posix()}.
listen(Opts) -> listen(Opts) ->