clear deadline in server
This commit is contained in:
parent
7982ab52a7
commit
65512193cc
@ -378,14 +378,12 @@ func (client *BlockSync) sendRequestToPeer(
|
||||
_ = stream.SetWriteDeadline(time.Now().Add(WRITE_REQ_DEADLINE))
|
||||
if err := cborutil.WriteCborRPC(stream, req); err != nil {
|
||||
_ = stream.SetWriteDeadline(time.Time{})
|
||||
// FIXME: What's the point of setting a blank deadline that won't time out?
|
||||
// Is this our way of clearing the old one?
|
||||
client.peerTracker.logFailure(peer, build.Clock.Since(connectionStart))
|
||||
// FIXME: Should we also remove peer here?
|
||||
return nil, err
|
||||
}
|
||||
// FIXME: Same, why are we doing this again here?
|
||||
_ = stream.SetWriteDeadline(time.Time{})
|
||||
_ = stream.SetWriteDeadline(time.Time{}) // clear deadline // FIXME: Needs
|
||||
// its own API (https://github.com/libp2p/go-libp2p-core/issues/162).
|
||||
|
||||
// Read response.
|
||||
var res Response
|
||||
|
@ -71,10 +71,12 @@ func (server *BlockSyncService) HandleStream(stream inet.Stream) {
|
||||
|
||||
_ = stream.SetDeadline(time.Now().Add(WRITE_RES_DEADLINE))
|
||||
if err := cborutil.WriteCborRPC(stream, resp); err != nil {
|
||||
_ = stream.SetDeadline(time.Time{})
|
||||
log.Warnw("failed to write back response for handle stream",
|
||||
"err", err, "peer", stream.Conn().RemotePeer())
|
||||
return
|
||||
}
|
||||
_ = stream.SetDeadline(time.Time{})
|
||||
}
|
||||
|
||||
// Validate and service the request. We return either a protocol
|
||||
|
Loading…
Reference in New Issue
Block a user