revert to real time for socket/stream deadlines.
This commit is contained in:
parent
55d88440eb
commit
fbf6596f20
@ -11,7 +11,6 @@ import (
|
|||||||
|
|
||||||
cborutil "github.com/filecoin-project/go-cbor-util"
|
cborutil "github.com/filecoin-project/go-cbor-util"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
"github.com/filecoin-project/lotus/chain/store"
|
"github.com/filecoin-project/lotus/chain/store"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
@ -127,7 +126,7 @@ func (bss *BlockSyncService) HandleStream(s inet.Stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeDeadline := 60 * time.Second
|
writeDeadline := 60 * time.Second
|
||||||
_ = s.SetDeadline(build.Clock.Now().Add(writeDeadline))
|
_ = s.SetDeadline(time.Now().Add(writeDeadline)) // always use real time for socket/stream deadlines.
|
||||||
if err := cborutil.WriteCborRPC(s, resp); err != nil {
|
if err := cborutil.WriteCborRPC(s, resp); err != nil {
|
||||||
log.Warnw("failed to write back response for handle stream", "err", err, "peer", s.Conn().RemotePeer())
|
log.Warnw("failed to write back response for handle stream", "err", err, "peer", s.Conn().RemotePeer())
|
||||||
return
|
return
|
||||||
|
@ -291,7 +291,7 @@ func (bs *BlockSync) fetchBlocksBlockSync(ctx context.Context, p peer.ID, req *B
|
|||||||
bs.RemovePeer(p)
|
bs.RemovePeer(p)
|
||||||
return nil, xerrors.Errorf("failed to open stream to peer: %w", err)
|
return nil, xerrors.Errorf("failed to open stream to peer: %w", err)
|
||||||
}
|
}
|
||||||
_ = s.SetWriteDeadline(build.Clock.Now().Add(5 * time.Second))
|
_ = s.SetWriteDeadline(time.Now().Add(5 * time.Second)) // always use real time for socket/stream deadlines.
|
||||||
|
|
||||||
if err := cborutil.WriteCborRPC(s, req); err != nil {
|
if err := cborutil.WriteCborRPC(s, req); err != nil {
|
||||||
_ = s.SetWriteDeadline(time.Time{})
|
_ = s.SetWriteDeadline(time.Time{})
|
||||||
|
Loading…
Reference in New Issue
Block a user