Skip to content

Commit

Permalink
Merge pull request #6355 from ipfs/fix/6354
Browse files Browse the repository at this point in the history
commands/swarm(fix): handle empty multiaddrs
  • Loading branch information
Stebalien authored May 20, 2019
2 parents 80f9f34 + 3aef795 commit cf3b6c4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
20 changes: 14 additions & 6 deletions core/commands/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,22 @@ var p2pCloseCmd = &cmds.Command{

proto := protocol.ID(protoOpt)

listen, err := ma.NewMultiaddr(listenOpt)
if err != nil {
return err
var (
target, listen ma.Multiaddr
)

if l {
listen, err = ma.NewMultiaddr(listenOpt)
if err != nil {
return err
}
}

target, err := ma.NewMultiaddr(targetOpt)
if err != nil {
return err
if t {
target, err = ma.NewMultiaddr(targetOpt)
if err != nil {
return err
}
}

if !(closeAll || p || l || t) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ require (
github.com/miekg/dns v1.1.10 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mr-tron/base58 v1.1.2
github.com/multiformats/go-multiaddr v0.0.3
github.com/multiformats/go-multiaddr v0.0.4
github.com/multiformats/go-multiaddr-dns v0.0.2
github.com/multiformats/go-multiaddr-net v0.0.1
github.com/multiformats/go-multibase v0.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9u
github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.0.2 h1:RBysRCv5rv3FWlhKWKoXv8tnsCUpEpIZpCmqAGZos2s=
github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.0.3 h1:/m5AmBtzEOIb9aY6o5pVuSwZeeCWrFks1MlqYsmHlBs=
github.com/multiformats/go-multiaddr v0.0.3/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4=
github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8=
github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
Expand Down

0 comments on commit cf3b6c4

Please sign in to comment.