Skip to content

Commit

Permalink
disconnect just takes pid
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenGround0 committed Jul 1, 2022
1 parent ef5bbde commit a686809
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
14 changes: 6 additions & 8 deletions cli/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ var NetListen = &cli.Command{
var NetDisconnect = &cli.Command{
Name: "disconnect",
Usage: "Disconnect from a peer",
ArgsUsage: "[peerMultiaddr|minerActorAddress]",
ArgsUsage: "[peerID]",
Action: func(cctx *cli.Context) error {
api, closer, err := GetAPI(cctx)
if err != nil {
Expand All @@ -274,13 +274,11 @@ var NetDisconnect = &cli.Command{
defer closer()
ctx := ReqContext(cctx)

pis, err := AddrInfoFromArg(ctx, cctx)
if err != nil {
return err
}
for _, pi := range pis {
fmt.Printf("disconnect %s: ", pi.ID.Pretty())
err := api.NetDisconnect(ctx, pi.ID)
ids := cctx.Args().Slice()
for _, id := range ids {
pid := peer.ID(id)
fmt.Printf("disconnect %s: ", pid.Pretty())
err := api.NetDisconnect(ctx, pid)
if err != nil {
fmt.Println("failure")
return err
Expand Down
2 changes: 1 addition & 1 deletion documentation/en/cli-lotus-miner.md
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ NAME:
lotus-miner net disconnect - Disconnect from a peer
USAGE:
lotus-miner net disconnect [command options] [peerMultiaddr|minerActorAddress]
lotus-miner net disconnect [command options] [peerID]
OPTIONS:
--help, -h show help (default: false)
Expand Down
2 changes: 1 addition & 1 deletion documentation/en/cli-lotus.md
Original file line number Diff line number Diff line change
Expand Up @@ -2552,7 +2552,7 @@ NAME:
lotus net disconnect - Disconnect from a peer
USAGE:
lotus net disconnect [command options] [peerMultiaddr|minerActorAddress]
lotus net disconnect [command options] [peerID]
OPTIONS:
--help, -h show help (default: false)
Expand Down

0 comments on commit a686809

Please sign in to comment.