Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
f1b68880
Commit
f1b68880
authored
Mar 18, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(swarm): use the go fork/join idiom
License: MIT Signed-off-by:
Steven Allen
<
steven@stebalien.com
>
parent
29161484
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
core/commands/swarm.go
core/commands/swarm.go
+8
-15
No files found.
core/commands/swarm.go
View file @
f1b68880
...
...
@@ -509,17 +509,6 @@ func resolveAddresses(ctx context.Context, addrs []string) ([]ma.Multiaddr, erro
resolveErrC
:=
make
(
chan
error
,
len
(
addrs
))
maddrC
:=
make
(
chan
ma
.
Multiaddr
)
go func() {
for {
select {
case maddr, ok := <-maddrC:
if !ok {
return
}
maddrs = append(maddrs, maddr)
}
}
}()
for
_
,
addr
:=
range
addrs
{
maddr
,
err
:=
ma
.
NewMultiaddr
(
addr
)
...
...
@@ -553,10 +542,14 @@ func resolveAddresses(ctx context.Context, addrs []string) ([]ma.Multiaddr, erro
}
}(
maddr
)
}
// wait for address resolving
wg.Wait()
// close the channel of collecting multiaddr
close(maddrC)
go
func
()
{
wg
.
Wait
()
close
(
maddrC
)
}()
for
maddr
:=
range
maddrC
{
maddrs
=
append
(
maddrs
,
maddr
)
}
select
{
case
err
:=
<-
resolveErrC
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment