Skip to content

Commit

Permalink
Merge pull request filecoin-project#5254 from turuslan/fix/chainxchg-…
Browse files Browse the repository at this point in the history
…buffered

Chainxchg write response timeout
  • Loading branch information
magik6k authored and bibibong committed Jan 9, 2021
1 parent be7a121 commit 4c6178d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion chain/exchange/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ func (s *server) HandleStream(stream inet.Stream) {
}

_ = 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{})
log.Warnw("failed to write back response for handle stream",
"err", err, "peer", stream.Conn().RemotePeer())
Expand Down

0 comments on commit 4c6178d

Please sign in to comment.