fix: use masp:get/3 to avoid crash after match failure

This commit is contained in:
EMQ-YangM 2022-03-30 09:30:51 +08:00
parent 4991dcbe3b
commit cead8c9056
1 changed files with 5 additions and 5 deletions

View File

@ -172,18 +172,18 @@ eventmsg_connected(_ClientInfo = #{
is_bridge := IsBridge, is_bridge := IsBridge,
mountpoint := Mountpoint mountpoint := Mountpoint
}, },
_ConnInfo = #{ ConnInfo = #{
peername := PeerName, peername := PeerName,
sockname := SockName, sockname := SockName,
clean_start := CleanStart, clean_start := CleanStart,
proto_name := ProtoName, proto_name := ProtoName,
proto_ver := ProtoVer, proto_ver := ProtoVer,
keepalive := Keepalive,
connected_at := ConnectedAt, connected_at := ConnectedAt,
conn_props := ConnProps, receive_maximum := RcvMax
receive_maximum := RcvMax,
expiry_interval := ExpiryInterval
}) -> }) ->
Keepalive = maps:get(keepalive, ConnInfo, 0),
ConnProps = maps:get(conn_props, ConnInfo, #{}),
ExpiryInterval = maps:get(expiry_interval, ConnInfo, 0),
with_basic_columns('client.connected', with_basic_columns('client.connected',
#{clientid => ClientId, #{clientid => ClientId,
username => Username, username => Username,