mzq-test
This commit is contained in:
parent
3b8c8b7557
commit
858c77e152
22
client.go
22
client.go
@ -110,6 +110,12 @@ func chainUnaryInterceptors(interceptors []UnaryClientInterceptor, final Invoker
|
||||
// NewClient creates a new ttrpc client using the given connection
|
||||
func NewClient(conn net.Conn, opts ...ClientOpts) *Client {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
a := log.Fields{
|
||||
"mzq-test": true,
|
||||
"conn": fmt.Sprintf("%+v", conn),
|
||||
"opts": fmt.Sprintf("%+v", opts),
|
||||
}
|
||||
log.G(ctx).WithFields(a).Info("client.go NewClient")
|
||||
channel := newChannel(conn)
|
||||
c := &Client{
|
||||
codec: codec{},
|
||||
@ -338,6 +344,12 @@ func (c *Client) UserOnCloseWait(ctx context.Context) error {
|
||||
|
||||
func (c *Client) run() {
|
||||
err := c.receiveLoop()
|
||||
a := log.Fields{
|
||||
"mzq-test": true,
|
||||
"c": fmt.Sprintf("%+v", c),
|
||||
"error": err,
|
||||
}
|
||||
log.G(c.ctx).WithFields(a).Errorf("ttrpc: received message on inactive stream")
|
||||
c.Close()
|
||||
c.cleanupStreams(err)
|
||||
|
||||
@ -368,7 +380,15 @@ func (c *Client) receiveLoop() error {
|
||||
sid := streamID(msg.header.StreamID)
|
||||
s := c.getStream(sid)
|
||||
if s == nil {
|
||||
log.G(c.ctx).WithField("stream", sid).Error("ttrpc: received message on inactive stream")
|
||||
a := log.Fields{
|
||||
"mzq-test": true,
|
||||
"stream": sid,
|
||||
"c": fmt.Sprintf("%+v", c),
|
||||
"header": msg.header,
|
||||
"msg.header": msg.header.Type.String(),
|
||||
"msg.payload": string(msg.payload),
|
||||
}
|
||||
log.G(c.ctx).WithFields(a).Errorf("ttrpc: received message on inactive stream")
|
||||
continue
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user