Skip to content

Commit 3122bae

Browse files
committed
jsonrpc2: add early continue if data is 0 and add debug log
1 parent 876ca1a commit 3122bae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jsonrpc2.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ func (c *Conn) Call(ctx context.Context, method string, params, result interface
185185
if err != nil {
186186
return xerrors.Errorf("failed to marshaling call request: %v", err)
187187
}
188+
c.logger.Debug("gojay.MarshalJSONObject(req)", zap.ByteString("data", data))
188189

189190
rchan := make(chan *Response)
190191
m, ok := c.pending.Load().(pendingMap)
@@ -377,6 +378,9 @@ func (c *Conn) Run(ctx context.Context) (err error) {
377378
if err != nil {
378379
return err // the stream failed, we cannot continue
379380
}
381+
if len(data) == 0 {
382+
continue
383+
}
380384

381385
// read a combined message
382386
msg := new(Combined)
@@ -386,7 +390,6 @@ func (c *Conn) Run(ctx context.Context) (err error) {
386390
c.logger.Debug(Receive,
387391
zap.Error(Errorf(CodeParseError, "unmarshal failed: %v", err)),
388392
)
389-
390393
continue
391394
}
392395

0 commit comments

Comments
 (0)