Skip to content

Commit fcbdab6

Browse files
committed
better uni connection tracing
1 parent acbe529 commit fcbdab6

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

client.go

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,14 @@ func (c *Client) getDisconnectPushReply(d Disconnect) ([]byte, error) {
353353
Code: d.Code,
354354
Reason: d.Reason,
355355
}
356+
push := &protocol.Push{
357+
Disconnect: disconnect,
358+
}
359+
if c.node.LogEnabled(LogLevelTrace) {
360+
c.traceOutPush(push)
361+
}
356362
return c.encodeReply(&protocol.Reply{
357-
Push: &protocol.Push{
358-
Disconnect: disconnect,
359-
},
363+
Push: push,
360364
})
361365
}
362366

@@ -2446,6 +2450,9 @@ func (c *Client) connectCmd(req *protocol.ConnectRequest, cmd *protocol.Command,
24462450
return nil, DisconnectServerError
24472451
}
24482452
c.writeEncodedPush(protoReply, rw, "", protocol.FrameTypePushConnect)
2453+
if c.node.LogEnabled(LogLevelTrace) {
2454+
c.traceOutPush(&protocol.Push{Connect: protoReply.Push.Connect})
2455+
}
24492456
}
24502457
} else {
24512458
protoReply, err := c.getConnectCommandReply(res)
@@ -2642,11 +2649,15 @@ func (c *Client) getSubscribePushReply(channel string, res *protocol.SubscribeRe
26422649
Positioned: res.GetPositioned(),
26432650
Data: res.Data,
26442651
}
2652+
push := &protocol.Push{
2653+
Channel: channel,
2654+
Subscribe: sub,
2655+
}
2656+
if c.node.LogEnabled(LogLevelTrace) {
2657+
c.traceOutPush(push)
2658+
}
26452659
return c.encodeReply(&protocol.Reply{
2646-
Push: &protocol.Push{
2647-
Channel: channel,
2648-
Subscribe: sub,
2649-
},
2660+
Push: push,
26502661
})
26512662
}
26522663

0 commit comments

Comments
 (0)