Merge pull request #5254 from turuslan/fix/chainxchg-buffered
Chainxchg write response timeout
This commit is contained in:
commit
a15080b563
@ -56,7 +56,11 @@ func (s *server) HandleStream(stream inet.Stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ = stream.SetDeadline(time.Now().Add(WriteResDeadline))
|
_ = stream.SetDeadline(time.Now().Add(WriteResDeadline))
|
||||||
if err := cborutil.WriteCborRPC(stream, resp); err != nil {
|
buffered := bufio.NewWriter(stream)
|
||||||
|
if err = cborutil.WriteCborRPC(buffered, resp); err == nil {
|
||||||
|
err = buffered.Flush()
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
_ = stream.SetDeadline(time.Time{})
|
_ = stream.SetDeadline(time.Time{})
|
||||||
log.Warnw("failed to write back response for handle stream",
|
log.Warnw("failed to write back response for handle stream",
|
||||||
"err", err, "peer", stream.Conn().RemotePeer())
|
"err", err, "peer", stream.Conn().RemotePeer())
|
||||||
|
Loading…
Reference in New Issue
Block a user