JianBo He 4 лет назад
Родитель
Сommit
8e4c2c88c3
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      apps/emqx_coap/src/emqx_coap_mqtt_adapter.erl

+ 4 - 2
apps/emqx_coap/src/emqx_coap_mqtt_adapter.erl

@@ -58,6 +58,8 @@
 
 -define(SUBOPTS, #{rh => 0, rap => 0, nl => 0, qos => ?QOS_0, is_new => false}).
 
+-define(PROTO_VER, 1).
+
 %%--------------------------------------------------------------------
 %% API
 %%--------------------------------------------------------------------
@@ -260,7 +262,7 @@ packet_to_message(Topic, Payload,
                 emqx_message:make(ClientId, ?QOS_0, Topic, Payload)
                ),
     emqx_message:set_headers(
-      #{ proto_ver => 1
+      #{ proto_ver => ?PROTO_VER
        , protocol => coap
        , username => Username
        , peerhost => PeerHost}, Message).
@@ -335,7 +337,7 @@ conninfo(#state{peername = Peername,
       peercert => nossl,        %% TODO: dtls
       conn_mod => ?MODULE,
       proto_name => <<"CoAP">>,
-      proto_ver => 1,
+      proto_ver => ?PROTO_VER,
       clean_start => true,
       clientid => ClientId,
       username => undefined,