فهرست منبع

Auth failure not publish the will message

turtled 8 سال پیش
والد
کامیت
88c77cf4c2
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      src/emqttd_protocol.erl

+ 5 - 1
src/emqttd_protocol.erl

@@ -387,7 +387,11 @@ shutdown(conflict, #proto_state{client_id = _ClientId}) ->
 shutdown(Error, State = #proto_state{will_msg = WillMsg}) ->
     ?LOG(debug, "Shutdown for ~p", [Error], State),
     Client = client(State),
-    send_willmsg(Client, WillMsg),
+    %% Auth failure not publish the will message
+    case Error =:= auth_failure of
+        true -> ok;
+        false -> send_willmsg(Client, WillMsg)
+    end,
     emqttd_hooks:run('client.disconnected', [Error], Client),
     %% let it down
     %% emqttd_cm:unreg(ClientId).