From de44a89c21880f6e679feeb1141787044c5e62a1 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Thu, 5 Sep 2019 18:28:17 +0800 Subject: [PATCH] Fix the issue that protocol is undefined --- src/emqx_channel.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/emqx_channel.erl b/src/emqx_channel.erl index f83aa8575..1902c232f 100644 --- a/src/emqx_channel.erl +++ b/src/emqx_channel.erl @@ -525,7 +525,10 @@ handle_out({connack, ReasonCode}, Channel = #channel{client = Client, protocol = Protocol }) -> ok = emqx_hooks:run('client.connected', [Client, ReasonCode, attrs(Channel)]), - ProtoVer = emqx_protocol:info(proto_ver, Protocol), + ProtoVer = case Protocol of + undefined -> undefined; + _ -> emqx_protocol:info(proto_ver, Protocol) + end, ReasonCode1 = if ProtoVer == ?MQTT_PROTO_V5 -> ReasonCode; true -> emqx_reason_codes:compat(connack, ReasonCode)