mirror of
https://github.com/seriyps/mtproto_proxy.git
synced 2026-08-04 07:08:10 +00:00
commit
9cb1984889
6 changed files with 6 additions and 6 deletions
|
|
@ -163,7 +163,7 @@ This will:
|
|||
|
||||
### Try to start in foreground mode
|
||||
|
||||
This step is optional, but it can be usefull to test if everything works as expected
|
||||
This step is optional, but it can be useful to test if everything works as expected
|
||||
|
||||
```bash
|
||||
./start.sh
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
%%% @author Sergey <me@seriyps.ru>
|
||||
%%% @copyright (C) 2018, Sergey
|
||||
%%% @doc
|
||||
%%% This module provieds a comination of crypto and packet codecs.
|
||||
%%% This module provieds a combination of crypto and packet codecs.
|
||||
%%% Crypto is always outer layer and packet is inner:
|
||||
%%% ( --- packet --- )
|
||||
%%% (-- crypto --)
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ build_backpressure_conf(UpstreamsPerDownstream, BpConf) ->
|
|||
orelse error({invalid_bytes_per_upstream, PacketsPerUpstream}),
|
||||
{PacketsTotal, BytesTotal, PacketsPerUpstream, BytesPerUpstream}.
|
||||
|
||||
%% Bumb counters of non-acked packets
|
||||
%% Bump counters of non-acked packets
|
||||
non_ack_bump(Upstream, Size, #state{non_ack_count = Cnt,
|
||||
non_ack_bytes = Oct,
|
||||
upstreams = Ups} = St) ->
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ do_check_health([{qlen, Limit} | _], #{message_queue_len := QLen} = Health) when
|
|||
overflow;
|
||||
do_check_health([{gc, Limit} | Other], #{total_mem := TotalMem}) when TotalMem > Limit ->
|
||||
%% Maybe it doesn't makes sense to do GC if queue len is more than, eg, 50?
|
||||
%% In this case allmost all memory will be in msg queue
|
||||
%% In this case almost all memory will be in msg queue
|
||||
mtp_metric:count_inc([?APP, healthcheck, total], 1,
|
||||
#{labels => [force_gc]}),
|
||||
erlang:garbage_collect(self()),
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ ping_session(Host, Port, Secret, DcId, Protocol, Timeout) ->
|
|||
unencrypted_cli_packet(Payload) ->
|
||||
Now = erlang:system_time(microsecond),
|
||||
%% Is 128 enough?
|
||||
PadSize = rand:uniform(128 div 4) * 4, % should be alined to 4b
|
||||
PadSize = rand:uniform(128 div 4) * 4, % should be aligned to 4b
|
||||
Padding = crypto:strong_rand_bytes(PadSize),
|
||||
unencrypted_cli_packet(Payload, Now, Padding).
|
||||
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ stop(Cfg) ->
|
|||
Cfg.
|
||||
|
||||
|
||||
%% Proces - wrapper holding client connections and states
|
||||
%% Process - wrapper holding client connections and states
|
||||
shim_add(Id, Conn) ->
|
||||
?MODULE ! {add, Id, Conn}.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue