Merge pull request #1749 from nats-io/fix_gw_system_account

[FIXED] System account was not properly tracking GW routed replies
This commit is contained in:
Ivan Kozlovic
2020-11-25 17:16:21 -07:00
committed by GitHub
2 changed files with 13 additions and 3 deletions

View File

@@ -2951,6 +2951,13 @@ func (c *client) deliverMsg(sub *subscription, subject, reply, mh, msg []byte, g
// Check for internal subscriptions.
if sub.icb != nil {
if gwrply {
// Note that we keep track of the GW routed reply in the destination
// connection (`client`). The routed reply subject is in `c.pa.reply`,
// should that change, we would have to pass the GW routed reply as
// a parameter of deliverMsg().
srv.trackGWReply(client, c.pa.reply)
}
client.mu.Unlock()
// Internal account clients are for service imports and need the '\r\n'.
if client.kind == ACCOUNT {
@@ -2988,9 +2995,10 @@ func (c *client) deliverMsg(sub *subscription, subject, reply, mh, msg []byte, g
// header (which is c.pa.reply without the GNR routing prefix).
if client.kind == CLIENT && len(c.pa.reply) > minReplyLen {
if gwrply {
// Note we keep track "in" the destination client (`client`) but the
// routed reply subject is in `c.pa.reply`. Should that change, we
// would have to pass the "reply" in deliverMsg().
// Note that we keep track of the GW routed reply in the destination
// connection (`client`). The routed reply subject is in `c.pa.reply`,
// should that change, we would have to pass the GW routed reply as
// a parameter of deliverMsg().
srv.trackGWReply(client, c.pa.reply)
}

View File

@@ -155,7 +155,9 @@ func runTrustedGateways(t *testing.T) (*Server, *Options, *Server, *Options, nke
sb := RunServer(optsB)
waitForInboundGateways(t, sa, 1, time.Second)
waitForOutboundGateways(t, sa, 1, time.Second)
waitForInboundGateways(t, sb, 1, time.Second)
waitForOutboundGateways(t, sb, 1, time.Second)
return sa, optsA, sb, optsB, akp