فهرست منبع

fix(sessds): Return peername of the disconnected client in the REST

ieQu1 1 سال پیش
والد
کامیت
a93f747afa
2فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 9 2
      apps/emqx_management/src/emqx_mgmt_api_clients.erl
  2. 1 0
      changes/ce/fix-12707.en.md

+ 9 - 2
apps/emqx_management/src/emqx_mgmt_api_clients.erl

@@ -1181,14 +1181,21 @@ format_persistent_session_info(ClientId, PSInfo0) ->
     Metadata = maps:get(metadata, PSInfo0, #{}),
     PSInfo1 = maps:with([created_at, expiry_interval], Metadata),
     CreatedAt = maps:get(created_at, PSInfo1),
+    case Metadata of
+        #{peername := PeerName} ->
+            {IpAddress, Port} = peername_dispart(PeerName);
+        _ ->
+            IpAddress = undefined,
+            Port = undefined
+    end,
     PSInfo2 = convert_expiry_interval_unit(PSInfo1),
     PSInfo3 = PSInfo2#{
         clientid => ClientId,
         connected => false,
         connected_at => CreatedAt,
-        ip_address => undefined,
+        ip_address => IpAddress,
         is_persistent => true,
-        port => undefined
+        port => Port
     },
     PSInfo = lists:foldl(
         fun result_format_time_fun/2,

+ 1 - 0
changes/ce/fix-12707.en.md

@@ -0,0 +1 @@
+Keep IP and port of the durable client sessions in the database.