diff options
author | Slava Yurin <[email protected]> | 2014-02-26 18:38:10 +0700 |
---|---|---|
committer | Slava Yurin <[email protected]> | 2014-06-03 18:28:15 +0700 |
commit | bac2faea84357980ce20d5ebcaa34f0550e0447a (patch) | |
tree | 68f0ce7a2b2151083fbee5abc56af7eb6802d43f /test/check_tcp_options.erl | |
parent | c1d0c4571ed744d4430576e171dc252937866974 (diff) | |
download | ranch-bac2faea84357980ce20d5ebcaa34f0550e0447a.tar.gz ranch-bac2faea84357980ce20d5ebcaa34f0550e0447a.tar.bz2 ranch-bac2faea84357980ce20d5ebcaa34f0550e0447a.zip |
Fix inherit listen options for accepted socket
Order of options in listen is undocumented but significant. Now user option will
replace default value if user set it.
Diffstat (limited to 'test/check_tcp_options.erl')
-rw-r--r-- | test/check_tcp_options.erl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/check_tcp_options.erl b/test/check_tcp_options.erl new file mode 100644 index 0000000..18432ac --- /dev/null +++ b/test/check_tcp_options.erl @@ -0,0 +1,15 @@ +-module(check_tcp_options). +-behaviour(ranch_protocol). + +-export([start_link/4]). +-export([init/3]). + +start_link(_, Socket, _, [{pid, TestPid}|TcpOptions]) -> + {ok, RealTcpOptions} = + inet:getopts(Socket, [Key || {Key, _} <- TcpOptions]), + Pid = spawn_link(?MODULE, init, [TestPid, RealTcpOptions, TcpOptions]), + {ok, Pid}. + +init(Pid, TcpOptions, TcpOptions) -> + Pid ! checked, + receive after 2500 -> ok end. |