Преглед изворни кода

fix(sessds): Graceful handling of shared subscription error

ieQu1 пре 1 година
родитељ
комит
c645cfa5d6
1 измењених фајлова са 10 додато и 0 уклоњено
  1. 10 0
      apps/emqx/src/emqx_persistent_session_ds.erl

+ 10 - 0
apps/emqx/src/emqx_persistent_session_ds.erl

@@ -337,6 +337,13 @@ print_session(ClientId) ->
 
 -spec subscribe(topic_filter(), emqx_types:subopts(), session()) ->
     {ok, session()} | {error, emqx_types:reason_code()}.
+subscribe(
+    #share{},
+    _SubOpts,
+    _Session
+) ->
+    %% TODO: Shared subscriptions are not supported yet:
+    {error, ?RC_SHARED_SUBSCRIPTIONS_NOT_SUPPORTED};
 subscribe(
     TopicFilter,
     SubOpts,
@@ -421,6 +428,9 @@ do_unsubscribe(SessionId, TopicFilter, Subscription = #{id := SubId}, S0) ->
 
 -spec get_subscription(topic_filter(), session()) ->
     emqx_types:subopts() | undefined.
+get_subscription(#share{}, _) ->
+    %% TODO: shared subscriptions are not supported yet:
+    undefined;
 get_subscription(TopicFilter, #{s := S}) ->
     case emqx_persistent_session_ds_subs:lookup(TopicFilter, S) of
         _Subscription = #{props := SubOpts} ->