Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: close empty libp2p streams #1920

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion datatransfer/network/libp2p_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ func (dtnet *libp2pDataTransferNetwork) handleNewStream(s network.Stream) {
for {
var received datatransfer.Message
var err error
_ = s.SetReadDeadline(time.Now().Add(dtnet.sendMessageTimeout))
switch s.Protocol() {
case datatransfer.ProtocolDataTransfer1_2:
received, err = message.FromNet(s)
Expand All @@ -253,9 +254,10 @@ func (dtnet *libp2pDataTransferNetwork) handleNewStream(s network.Stream) {
go dtnet.receiver.ReceiveError(err)
log.Debugf("net handleNewStream from %s error: %s", p, err)
}
_ = s.SetReadDeadline(time.Time{})
return
}

_ = s.SetReadDeadline(time.Time{})
ctx := context.Background()
log.Debugf("net handleNewStream from %s", p)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ require (
)

require (
github.com/filecoin-project/boost-graphsync v0.13.10
github.com/filecoin-project/boost-graphsync v0.13.11
github.com/filecoin-project/boost/extern/boostd-data v0.0.0-20231124125934-3233c510357f
github.com/filecoin-project/go-data-segment v0.0.1
github.com/filecoin-project/lotus v1.26.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/filecoin-project/boost-graphsync v0.13.10 h1:L6qxpyognlcH73+vEPBXR8pbSMijXSV2CuV/sz0QDpA=
github.com/filecoin-project/boost-graphsync v0.13.10/go.mod h1:bc2M5ZLZJtXHl8kjnqtn4L1MsdEqpJErDaIeY0bJ9wk=
github.com/filecoin-project/boost-graphsync v0.13.11 h1:quhAvlz+26D1xLH5v5XfWFfuxsZEcwbpbZxmF5ZNJzw=
github.com/filecoin-project/boost-graphsync v0.13.11/go.mod h1:bc2M5ZLZJtXHl8kjnqtn4L1MsdEqpJErDaIeY0bJ9wk=
github.com/filecoin-project/boost/extern/boostd-data v0.0.0-20231124125934-3233c510357f h1:8dd0yAadyeOL5Qd42XhEwD60UKvIFkY2MLhef/IaeOk=
github.com/filecoin-project/boost/extern/boostd-data v0.0.0-20231124125934-3233c510357f/go.mod h1:MyzvfYWAH0OAyf95TLUWYq3cO3vm/TVzDS57GKQi47o=
github.com/filecoin-project/dagstore v0.7.0 h1:IS0R+69za8dguYWeqz/MI+nb7ONpk03tAkxPCBXEKm0=
Expand Down
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,7 @@ github.com/fatih/structs v0.0.0-20180123065059-ebf56d35bba7/go.mod h1:9NiDSp5zOc
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/filecoin-project/boost-graphsync v0.13.11/go.mod h1:bc2M5ZLZJtXHl8kjnqtn4L1MsdEqpJErDaIeY0bJ9wk=
github.com/filecoin-project/boost/extern/boostd-data v0.0.0-20231009154452-ca8daa2870f3/go.mod h1:vHUM62fb82DpsBSXptQjpvcysjoV2Guc1MVJiIYccfQ=
github.com/filecoin-project/filecoin-ffi v0.30.4-0.20220519234331-bfd1f5f9fe38/go.mod h1:GM5pXRYvQM7wyH6V2WtPnJ2k1jt+qotRkWLxBSRCOuE=
github.com/filecoin-project/go-dagaggregator-unixfs v0.3.0 h1:UXLtBUnPa61LkNa2GqhP+aJ53bOnHP/dzg6/wk2rnsA=
Expand Down
Loading