fix: cancel transfer cancels storage deal
This commit is contained in:
parent
aa278443d3
commit
c66e594046
@ -1825,6 +1825,11 @@ var clientCancelTransfer = &cli.Command{
|
||||
Usage: "specify only transfers where peer is/is not initiator",
|
||||
Value: true,
|
||||
},
|
||||
&cli.DurationFlag{
|
||||
Name: "cancel-timeout",
|
||||
Usage: "time to wait for cancel to be sent to storage provider",
|
||||
Value: 5 * time.Second,
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if !cctx.Args().Present() {
|
||||
@ -1868,7 +1873,9 @@ var clientCancelTransfer = &cli.Command{
|
||||
}
|
||||
}
|
||||
|
||||
return api.ClientCancelDataTransfer(ctx, transferID, other, initiator)
|
||||
timeoutCtx, cancel := context.WithTimeout(ctx, cctx.Duration("cancel-timeout"))
|
||||
defer cancel()
|
||||
return api.ClientCancelDataTransfer(timeoutCtx, transferID, other, initiator)
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@ -650,6 +651,11 @@ var marketCancelTransfer = &cli.Command{
|
||||
Usage: "specify only transfers where peer is/is not initiator",
|
||||
Value: false,
|
||||
},
|
||||
&cli.DurationFlag{
|
||||
Name: "cancel-timeout",
|
||||
Usage: "time to wait for cancel to be sent to client",
|
||||
Value: 5 * time.Second,
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
if !cctx.Args().Present() {
|
||||
@ -693,7 +699,9 @@ var marketCancelTransfer = &cli.Command{
|
||||
}
|
||||
}
|
||||
|
||||
return nodeApi.MarketCancelDataTransfer(ctx, transferID, other, initiator)
|
||||
timeoutCtx, cancel := context.WithTimeout(ctx, cctx.Duration("cancel-timeout"))
|
||||
defer cancel()
|
||||
return nodeApi.MarketCancelDataTransfer(timeoutCtx, transferID, other, initiator)
|
||||
},
|
||||
}
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -32,7 +32,7 @@ require (
|
||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03
|
||||
github.com/filecoin-project/go-data-transfer v1.2.0
|
||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a
|
||||
github.com/filecoin-project/go-fil-markets v1.0.7
|
||||
github.com/filecoin-project/go-fil-markets v1.0.8-0.20201127142850-25afe9e33804
|
||||
github.com/filecoin-project/go-jsonrpc v0.1.2
|
||||
github.com/filecoin-project/go-multistore v0.0.3
|
||||
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20
|
||||
|
5
go.sum
5
go.sum
@ -253,6 +253,7 @@ github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 h1:2pMX
|
||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ=
|
||||
github.com/filecoin-project/go-data-transfer v1.0.1 h1:5sYKDbstyDsdJpVP4UGUW6+BgCNfgnH8hQgf0E3ZAno=
|
||||
github.com/filecoin-project/go-data-transfer v1.0.1/go.mod h1:UxvfUAY9v3ub0a21BSK9u3pB2aq30Y0KMsG+w9/ysyo=
|
||||
github.com/filecoin-project/go-data-transfer v1.1.1-0.20201127133903-9944ad93a52a/go.mod h1:ZAH51JZFR8NZC4FPiDPG+swjgui0q6zTMJbztc6pHhY=
|
||||
github.com/filecoin-project/go-data-transfer v1.2.0 h1:LM+K+J+y9t8e3gYskJHWDlyHJsF6aaxoHOP+HIiVE1U=
|
||||
github.com/filecoin-project/go-data-transfer v1.2.0/go.mod h1:ZAH51JZFR8NZC4FPiDPG+swjgui0q6zTMJbztc6pHhY=
|
||||
github.com/filecoin-project/go-ds-versioning v0.1.0 h1:y/X6UksYTsK8TLCI7rttCKEvl8btmWxyFMEeeWGUxIQ=
|
||||
@ -262,8 +263,8 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go
|
||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a h1:hyJ+pUm/4U4RdEZBlg6k8Ma4rDiuvqyGpoICXAxwsTg=
|
||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
|
||||
github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c=
|
||||
github.com/filecoin-project/go-fil-markets v1.0.7 h1:t6zfm2wvL5jVCewy4RLINaembmHuxqC3dZCSqq9dtH8=
|
||||
github.com/filecoin-project/go-fil-markets v1.0.7/go.mod h1:iVYc+VrHIP15F5COkHNM6ndTwKSJ7qPrHSKCfFUnve4=
|
||||
github.com/filecoin-project/go-fil-markets v1.0.8-0.20201127142850-25afe9e33804 h1:nr3jCJ+vFTf6nmWx2Vs1PZYGeiUj3GY+z25sPwU7pRk=
|
||||
github.com/filecoin-project/go-fil-markets v1.0.8-0.20201127142850-25afe9e33804/go.mod h1:BU1ugMGWQsTIKvvR/KiodZAim6hoHZhXP193rNRgCAM=
|
||||
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
|
||||
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
|
||||
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
|
||||
|
Loading…
Reference in New Issue
Block a user