chore: improve some logs in emqx_connection
This commit is contained in:
parent
049a18416e
commit
49bf7a7db1
|
@ -654,13 +654,10 @@ parse_incoming(Data, Packets, State = #state{parse_state = ParseState}) ->
|
||||||
parse_incoming(Rest, [Packet | Packets], NState)
|
parse_incoming(Rest, [Packet | Packets], NState)
|
||||||
catch
|
catch
|
||||||
error:proxy_protocol_config_disabled:_Stk ->
|
error:proxy_protocol_config_disabled:_Stk ->
|
||||||
?LOG(error,
|
?LOG(error, "Received proxy protocol header but the 'proxy_protocol' config is disabled"),
|
||||||
"~nMalformed packet, "
|
|
||||||
"please check proxy_protocol config for specific listeners and zones~n"),
|
|
||||||
{[{frame_error, proxy_protocol_config_disabled} | Packets], State};
|
{[{frame_error, proxy_protocol_config_disabled} | Packets], State};
|
||||||
error:Reason:Stk ->
|
error:Reason:Stk ->
|
||||||
?LOG(error, "~nParse failed for ~0p~n~0p~nFrame data:~0p",
|
?LOG(error, "Parse failed for ~0p, ~0p, Frame data: ~0p", [Reason, Stk, Data]),
|
||||||
[Reason, Stk, Data]),
|
|
||||||
{[{frame_error, Reason} | Packets], State}
|
{[{frame_error, Reason} | Packets], State}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ init(Req, Opts) ->
|
||||||
|
|
||||||
case check_origin_header(Req, Opts) of
|
case check_origin_header(Req, Opts) of
|
||||||
{error, Message} ->
|
{error, Message} ->
|
||||||
?LOG(error, "Invalid Origin Header ~p~n", [Message]),
|
?LOG(error, "Invalid Origin Header ~p", [Message]),
|
||||||
{ok, cowboy_req:reply(403, Req), WsOpts};
|
{ok, cowboy_req:reply(403, Req), WsOpts};
|
||||||
ok -> parse_sec_websocket_protocol(Req, Opts, WsOpts)
|
ok -> parse_sec_websocket_protocol(Req, Opts, WsOpts)
|
||||||
end.
|
end.
|
||||||
|
@ -408,7 +408,7 @@ websocket_info(Info, State) ->
|
||||||
websocket_close({_, ReasonCode, _Payload}, State) when is_integer(ReasonCode) ->
|
websocket_close({_, ReasonCode, _Payload}, State) when is_integer(ReasonCode) ->
|
||||||
websocket_close(ReasonCode, State);
|
websocket_close(ReasonCode, State);
|
||||||
websocket_close(Reason, State) ->
|
websocket_close(Reason, State) ->
|
||||||
?LOG(debug, "Websocket closed due to ~p~n", [Reason]),
|
?LOG(debug, "Websocket closed due to ~p", [Reason]),
|
||||||
handle_info({sock_closed, Reason}, State).
|
handle_info({sock_closed, Reason}, State).
|
||||||
|
|
||||||
terminate(Reason, _Req, #state{channel = Channel}) ->
|
terminate(Reason, _Req, #state{channel = Channel}) ->
|
||||||
|
@ -554,7 +554,7 @@ parse_incoming(Data, State = #state{parse_state = ParseState}) ->
|
||||||
parse_incoming(Rest, postpone({incoming, Packet}, NState))
|
parse_incoming(Rest, postpone({incoming, Packet}, NState))
|
||||||
catch
|
catch
|
||||||
error:Reason:Stk ->
|
error:Reason:Stk ->
|
||||||
?LOG(error, "~nParse failed for ~0p~n~0p~nFrame data: ~0p",
|
?LOG(error, "Parse failed for ~0p, ~0p, Frame data: ~0p",
|
||||||
[Reason, Stk, Data]),
|
[Reason, Stk, Data]),
|
||||||
FrameError = {frame_error, Reason},
|
FrameError = {frame_error, Reason},
|
||||||
postpone({incoming, FrameError}, State)
|
postpone({incoming, FrameError}, State)
|
||||||
|
|
Loading…
Reference in New Issue