Fix timeout state switch

This commit is contained in:
Sergey Prokhorov 2018-05-30 11:25:34 +02:00
parent d2fab355bf
commit 8b2e3906cc
3 changed files with 15 additions and 3 deletions

View file

@ -42,6 +42,13 @@ Stop proxy started in background
./_build/default/rel/mtp_proxy/bin/mtp_proxy stop
```
Settings
--------
See `src/mtproto_proxy.app.src`.
Secret key will be printed on start.
Helpers
-------

View file

@ -230,9 +230,10 @@ handle_upstream_header(Endpoint, UpCodec, S) ->
EndpointStr = inet:ntoa(Endpoint),
lager:info("Connected to ~s:~p", [EndpointStr, 443]),
ok = gen_tcp:send(Sock, <<239>>),
{ok, S#state{stage = tunnel,
down_sock = Sock,
up_codec = UpCodec}};
{ok, switch_timer(S#state{stage = tunnel,
down_sock = Sock,
up_codec = UpCodec},
hibernate)};
{error, _Reason} = Err ->
Err
end.

View file

@ -11,6 +11,10 @@
stdlib
]},
{env,[
{init_timeout_sec, 60},
{hibernate_timeout_sec, 60},
{ready_timeout_sec, 1200},
{ip, {0, 0, 0, 0}},
{ports, [{mtp_handler, 4430}]},
{num_acceptors, 60},