bugfix: Clear .hello_acc in mtp_handler when no longer needed

Before fix accumulator was never cleaned, taking memory.
Clear the accumulator on transition to tunnel stage (handshake complete)
and on transition to fronting stage (data already forwarded to front_sock).
This commit is contained in:
Sergey Prokhorov 2026-04-06 17:43:18 +02:00
parent f24b70db80
commit 26fe4bc0e8
No known key found for this signature in database
GPG key ID: 1C570244E4EF3337

View file

@ -427,7 +427,8 @@ parse_upstream_data(<<Header:64/binary, Rest/binary>>,
dc_id = {RealDcId, Pool},
codec = Codec,
policy_state = PState,
stage = tunnel},
stage = tunnel,
hello_acc = <<>>},
hibernate));
{error, Reason} when is_atom(Reason) ->
mtp_metric:count_inc([?APP, protocol_error, total], 1, #{labels => [Listener, Reason]}),
@ -538,7 +539,7 @@ do_front(SniDomain, Config, Data, Ip, Listener,
ok = gen_tcp:send(FrontSock, Data),
ok = Transport:setopts(Sock, [{active, once}]),
?LOG_INFO("Domain fronting to ~s:~p for SNI ~s", [Host, Port, SniDomain]),
{ok, S#state{stage = fronting, front_sock = FrontSock}};
{ok, S#state{stage = fronting, front_sock = FrontSock, hello_acc = <<>>}};
{error, Reason} ->
?LOG_WARNING("Domain fronting connect to ~s:~p failed: ~p",
[Host, Port, Reason]),