aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_acceptor.erl4
-rw-r--r--src/cowboy_http_protocol.erl6
-rw-r--r--src/cowboy_requests_sup.erl2
-rw-r--r--src/cowboy_tcp_transport.erl19
4 files changed, 16 insertions, 15 deletions
diff --git a/src/cowboy_acceptor.erl b/src/cowboy_acceptor.erl
index ac89874..db70817 100644
--- a/src/cowboy_acceptor.erl
+++ b/src/cowboy_acceptor.erl
@@ -20,7 +20,7 @@
%% API.
--spec start_link(LSocket::socket(), Transport::module(),
+-spec start_link(LSocket::inet:socket(), Transport::module(),
Protocol::module(), Opts::term(), ReqsSup::pid()) -> {ok, Pid::pid()}.
start_link(LSocket, Transport, Protocol, Opts, ReqsSup) ->
Pid = spawn_link(?MODULE, acceptor,
@@ -29,7 +29,7 @@ start_link(LSocket, Transport, Protocol, Opts, ReqsSup) ->
%% Internal.
--spec acceptor(LSocket::socket(), Transport::module(),
+-spec acceptor(LSocket::inet:socket(), Transport::module(),
Protocol::module(), Opts::term(), ReqsSup::pid()) -> no_return().
acceptor(LSocket, Transport, Protocol, Opts, ReqsSup) ->
case Transport:accept(LSocket, 2000) of
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl
index aa1df39..0094e8b 100644
--- a/src/cowboy_http_protocol.erl
+++ b/src/cowboy_http_protocol.erl
@@ -20,7 +20,7 @@
-include("include/http.hrl").
-record(state, {
- socket :: socket(),
+ socket :: inet:socket(),
transport :: module(),
dispatch :: dispatch(),
handler :: {Handler::module(), Opts::term()},
@@ -32,7 +32,7 @@
%% API.
--spec start_link(Socket::socket(), Transport::module(), Opts::term())
+-spec start_link(Socket::inet:socket(), Transport::module(), Opts::term())
-> {ok, Pid::pid()}.
start_link(Socket, Transport, Opts) ->
Pid = spawn_link(?MODULE, init, [Socket, Transport, Opts]),
@@ -40,7 +40,7 @@ start_link(Socket, Transport, Opts) ->
%% FSM.
--spec init(Socket::socket(), Transport::module(), Opts::term()) -> ok.
+-spec init(Socket::inet:socket(), Transport::module(), Opts::term()) -> ok.
init(Socket, Transport, Opts) ->
Dispatch = proplists:get_value(dispatch, Opts, []),
MaxEmptyLines = proplists:get_value(max_empty_lines, Opts, 5),
diff --git a/src/cowboy_requests_sup.erl b/src/cowboy_requests_sup.erl
index af6db7e..a759205 100644
--- a/src/cowboy_requests_sup.erl
+++ b/src/cowboy_requests_sup.erl
@@ -26,7 +26,7 @@
start_link() ->
supervisor:start_link(?MODULE, []).
--spec start_request(Socket::socket(), Transport::module(),
+-spec start_request(Socket::inet:socket(), Transport::module(),
Protocol::module(), Opts::term()) -> {ok, Pid::pid()}.
start_request(Socket, Transport, Protocol, Opts) ->
Protocol:start_link(Socket, Transport, Opts).
diff --git a/src/cowboy_tcp_transport.erl b/src/cowboy_tcp_transport.erl
index 8bcd062..7ffd0b1 100644
--- a/src/cowboy_tcp_transport.erl
+++ b/src/cowboy_tcp_transport.erl
@@ -27,42 +27,43 @@ name() -> tcp.
messages() -> {tcp, tcp_closed, tcp_error}.
-spec listen([{port, Port::port_number()}])
- -> {ok, LSocket::socket()} | {error, Reason::posix()}.
+ -> {ok, LSocket::inet:socket()} | {error, Reason::posix()}.
listen(Opts) ->
{port, Port} = lists:keyfind(port, 1, Opts),
gen_tcp:listen(Port, [binary, {active, false},
{packet, raw}, {reuseaddr, true}]).
--spec accept(LSocket::socket(), Timeout::timeout())
- -> {ok, Socket::socket()} | {error, Reason::closed | timeout | posix()}.
+-spec accept(LSocket::inet:socket(), Timeout::timeout())
+ -> {ok, Socket::inet:socket()}
+ | {error, Reason::closed | timeout | posix()}.
accept(LSocket, Timeout) ->
gen_tcp:accept(LSocket, Timeout).
--spec recv(Socket::socket(), Length::integer(), Timeout::timeout())
+-spec recv(Socket::inet:socket(), Length::integer(), Timeout::timeout())
-> {ok, Packet::term()} | {error, Reason::closed | posix()}.
recv(Socket, Length, Timeout) ->
gen_tcp:recv(Socket, Length, Timeout).
--spec send(Socket::socket(), Packet::iolist())
+-spec send(Socket::inet:socket(), Packet::iolist())
-> ok | {error, Reason::posix()}.
send(Socket, Packet) ->
gen_tcp:send(Socket, Packet).
--spec setopts(Socket::socket(), Opts::list(term()))
+-spec setopts(Socket::inet:socket(), Opts::list(term()))
-> ok | {error, Reason::posix()}.
setopts(Socket, Opts) ->
inet:setopts(Socket, Opts).
--spec controlling_process(Socket::socket(), Pid::pid())
+-spec controlling_process(Socket::inet:socket(), Pid::pid())
-> ok | {error, Reason::closed | not_owner | posix()}.
controlling_process(Socket, Pid) ->
gen_tcp:controlling_process(Socket, Pid).
--spec peername(Socket::socket())
+-spec peername(Socket::inet:socket())
-> {ok, {Address::inet:ip_address(), Port::port_number()}} | {error, posix()}.
peername(Socket) ->
inet:peername(Socket).
--spec close(Socket::socket()) -> ok.
+-spec close(Socket::inet:socket()) -> ok.
close(Socket) ->
gen_tcp:close(Socket).