Explorar el Código

fix(sys): compatible with binary type protocol

JianBo He hace 3 años
padre
commit
6a4d823b24
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      apps/emqx/src/emqx_sys.erl

+ 5 - 2
apps/emqx/src/emqx_sys.erl

@@ -365,10 +365,13 @@ event_topic(Event, #{clientid := ClientId, protocol := GwName}) ->
         [
             systop("gateway"),
             "/",
-            atom_to_binary(GwName),
+            bin(GwName),
             "/clients/",
             ClientId,
             "/",
-            atom_to_binary(Event)
+            bin(Event)
         ]
     ).
+
+bin(A) when is_atom(A) -> atom_to_binary(A);
+bin(B) when is_binary(B) -> B.