check_tcp_options.erl 410 B

123456789101112131415
  1. -module(check_tcp_options).
  2. -behaviour(ranch_protocol).
  3. -export([start_link/4]).
  4. -export([init/3]).
  5. start_link(_, Socket, _, [{pid, TestPid}|TcpOptions]) ->
  6. {ok, RealTcpOptions} =
  7. inet:getopts(Socket, [Key || {Key, _} <- TcpOptions]),
  8. Pid = spawn_link(?MODULE, init, [TestPid, RealTcpOptions, TcpOptions]),
  9. {ok, Pid}.
  10. init(Pid, TcpOptions, TcpOptions) ->
  11. Pid ! checked,
  12. receive after 2500 -> ok end.