From fbf6596f20744628212d4b6a5c92ded32ae0693f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Tue, 14 Jul 2020 17:42:52 +0100 Subject: [PATCH] revert to real time for socket/stream deadlines. --- chain/blocksync/blocksync.go | 3 +-- chain/blocksync/blocksync_client.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/chain/blocksync/blocksync.go b/chain/blocksync/blocksync.go index 53b9feeff..f5483eeae 100644 --- a/chain/blocksync/blocksync.go +++ b/chain/blocksync/blocksync.go @@ -11,7 +11,6 @@ import ( 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/types" @@ -127,7 +126,7 @@ func (bss *BlockSyncService) HandleStream(s inet.Stream) { } 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 { log.Warnw("failed to write back response for handle stream", "err", err, "peer", s.Conn().RemotePeer()) return diff --git a/chain/blocksync/blocksync_client.go b/chain/blocksync/blocksync_client.go index ac8bcc7a1..67e4fde8f 100644 --- a/chain/blocksync/blocksync_client.go +++ b/chain/blocksync/blocksync_client.go @@ -291,7 +291,7 @@ func (bs *BlockSync) fetchBlocksBlockSync(ctx context.Context, p peer.ID, req *B bs.RemovePeer(p) 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 { _ = s.SetWriteDeadline(time.Time{})