Skip to content

Commit

Permalink
close empty streams
Browse files Browse the repository at this point in the history
  • Loading branch information
LexLuthr committed May 20, 2024
1 parent 754f452 commit df55566
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions network/libp2p_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ func (gsnet *libp2pGraphSyncNetwork) handleNewStream(s network.Stream) {
reader := msgio.NewVarintReaderSize(s, network.MessageSizeMax)
for {
p = s.Conn().RemotePeer()
_ = s.SetReadDeadline(time.Now().Add(time.Second * 10))
received, err := gsnet.messageHandlerSelector.Select(s.Protocol()).FromMsgReader(s.Conn().RemotePeer(), reader)

if err != nil {
Expand All @@ -239,8 +240,10 @@ func (gsnet *libp2pGraphSyncNetwork) handleNewStream(s network.Stream) {
go gsnet.receiver.ReceiveError(p, err)
log.Debugf("graphsync net handleNewStream from %s error: %s", s.Conn().RemotePeer(), err)
}
_ = s.SetReadDeadline(time.Time{})
return
}
_ = s.SetReadDeadline(time.Time{})

ctx := context.Background()
log.Debugf("graphsync net handleNewStream from %s", s.Conn().RemotePeer())
Expand Down

0 comments on commit df55566

Please sign in to comment.