fix tcp channel

This commit is contained in:
anlicheng 2025-09-19 16:57:19 +08:00
parent 9d91c0ef1e
commit 2a9773dfc9
2 changed files with 2 additions and 7 deletions

View File

@ -58,7 +58,6 @@ start_http_server() ->
num_acceptors => Acceptors,
shutdown => brutal_kill,
socket_opts => [
{reuseaddr, true},
{backlog, Backlog},
{port, Port}
]
@ -80,10 +79,6 @@ start_tcp_server() ->
num_acceptors => Acceptors,
shutdown => brutal_kill,
socket_opts => [
binary,
{packet, 4},
{reuseaddr, true},
{active, false},
{nodelay, false},
{backlog, Backlog},
{port, Port}

View File

@ -66,7 +66,7 @@ start_link(Ref, Transport, Opts) ->
init(Ref, Transport, _Opts = []) ->
{ok, Socket} = ranch:handshake(Ref),
lager:debug("[sdlan_channel] get a new connection: ~p", [Socket]),
Transport:setopts(Socket, [{active, true}]),
Transport:setopts(Socket, [binary, {active, true}, {packet, 4}]),
% erlang:start_timer(?PING_TICKER, self(), ping_ticker),
gen_server:enter_loop(?MODULE, [], #state{transport = Transport, socket = Socket}).
@ -181,7 +181,7 @@ handle_info({'DOWN', _, process, HostPid, Reason}, State = #state{uuid = UUID, h
{stop, State};
handle_info(Info, State) ->
lager:warning("[sdlan_channel] get a unknown message: ~p, channel will closed", [Info]),
lager:warning("[sdlan_channel] get a unknown message: ~p, channel will closed, state: ~p", [Info, State]),
{noreply, State}.
terminate(Reason, #state{}) ->