fix(exproto): fix undefined clientid in client.connect hook
This commit is contained in:
parent
58db1eb5a9
commit
515fd014d3
|
@ -151,7 +151,7 @@ init(ConnInfo = #{socktype := Socktype,
|
|||
peercert := Peercert}, Options) ->
|
||||
GRpcChann = proplists:get_value(handler, Options),
|
||||
NConnInfo = default_conninfo(ConnInfo),
|
||||
ClientInfo = default_clientinfo(ConnInfo),
|
||||
ClientInfo = default_clientinfo(NConnInfo),
|
||||
|
||||
IdleTimeout = proplists:get_value(idle_timeout, Options, ?DEFAULT_IDLE_TIMEOUT),
|
||||
|
||||
|
@ -633,9 +633,10 @@ enrich_clientinfo(InClientInfo = #{proto_name := ProtoName}, ClientInfo) ->
|
|||
NClientInfo = maps:merge(ClientInfo, maps:with(Ks, InClientInfo)),
|
||||
NClientInfo#{protocol => ProtoName}.
|
||||
|
||||
default_conninfo(ConnInfo) ->
|
||||
default_conninfo(ConnInfo =
|
||||
#{peername := {PeerHost, PeerPort}}) ->
|
||||
ConnInfo#{clean_start => true,
|
||||
clientid => undefined,
|
||||
clientid => anonymous_clientid(PeerHost, PeerPort),
|
||||
username => undefined,
|
||||
conn_props => #{},
|
||||
connected => true,
|
||||
|
@ -646,13 +647,15 @@ default_conninfo(ConnInfo) ->
|
|||
receive_maximum => 0,
|
||||
expiry_interval => 0}.
|
||||
|
||||
default_clientinfo(#{peername := {PeerHost, PeerPort},
|
||||
sockname := {_, SockPort}}) ->
|
||||
default_clientinfo(#{peername := {PeerHost, _},
|
||||
sockname := {_, SockPort},
|
||||
clientid := ClientId
|
||||
}) ->
|
||||
#{zone => external,
|
||||
protocol => exproto,
|
||||
peerhost => PeerHost,
|
||||
sockport => SockPort,
|
||||
clientid => anonymous_clientid(PeerHost, PeerPort),
|
||||
clientid => ClientId,
|
||||
username => undefined,
|
||||
is_bridge => false,
|
||||
is_superuser => false,
|
||||
|
|
Loading…
Reference in New Issue