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) ->
|
peercert := Peercert}, Options) ->
|
||||||
GRpcChann = proplists:get_value(handler, Options),
|
GRpcChann = proplists:get_value(handler, Options),
|
||||||
NConnInfo = default_conninfo(ConnInfo),
|
NConnInfo = default_conninfo(ConnInfo),
|
||||||
ClientInfo = default_clientinfo(ConnInfo),
|
ClientInfo = default_clientinfo(NConnInfo),
|
||||||
|
|
||||||
IdleTimeout = proplists:get_value(idle_timeout, Options, ?DEFAULT_IDLE_TIMEOUT),
|
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 = maps:merge(ClientInfo, maps:with(Ks, InClientInfo)),
|
||||||
NClientInfo#{protocol => ProtoName}.
|
NClientInfo#{protocol => ProtoName}.
|
||||||
|
|
||||||
default_conninfo(ConnInfo) ->
|
default_conninfo(ConnInfo =
|
||||||
|
#{peername := {PeerHost, PeerPort}}) ->
|
||||||
ConnInfo#{clean_start => true,
|
ConnInfo#{clean_start => true,
|
||||||
clientid => undefined,
|
clientid => anonymous_clientid(PeerHost, PeerPort),
|
||||||
username => undefined,
|
username => undefined,
|
||||||
conn_props => #{},
|
conn_props => #{},
|
||||||
connected => true,
|
connected => true,
|
||||||
|
@ -646,13 +647,15 @@ default_conninfo(ConnInfo) ->
|
||||||
receive_maximum => 0,
|
receive_maximum => 0,
|
||||||
expiry_interval => 0}.
|
expiry_interval => 0}.
|
||||||
|
|
||||||
default_clientinfo(#{peername := {PeerHost, PeerPort},
|
default_clientinfo(#{peername := {PeerHost, _},
|
||||||
sockname := {_, SockPort}}) ->
|
sockname := {_, SockPort},
|
||||||
|
clientid := ClientId
|
||||||
|
}) ->
|
||||||
#{zone => external,
|
#{zone => external,
|
||||||
protocol => exproto,
|
protocol => exproto,
|
||||||
peerhost => PeerHost,
|
peerhost => PeerHost,
|
||||||
sockport => SockPort,
|
sockport => SockPort,
|
||||||
clientid => anonymous_clientid(PeerHost, PeerPort),
|
clientid => ClientId,
|
||||||
username => undefined,
|
username => undefined,
|
||||||
is_bridge => false,
|
is_bridge => false,
|
||||||
is_superuser => false,
|
is_superuser => false,
|
||||||
|
|
Loading…
Reference in New Issue