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
31dc65b9
Commit
31dc65b9
authored
Aug 01, 2014
by
Jeromy
Committed by
Juan Batiz-Benet
Aug 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up after listeners on shutdown
parent
92fb51d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
swarm/swarm.go
swarm/swarm.go
+8
-0
No files found.
swarm/swarm.go
View file @
31dc65b9
...
...
@@ -81,6 +81,7 @@ type Swarm struct {
connsLock
sync
.
RWMutex
local
*
peer
.
Peer
listeners
[]
net
.
Listener
}
// NewSwarm constructs a Swarm, with a Chan.
...
...
@@ -126,6 +127,9 @@ func (s *Swarm) connListen(maddr *ma.Multiaddr) error {
return
err
}
// NOTE: this may require a lock around it later. currently, only run on setup
s
.
listeners
=
append
(
s
.
listeners
,
list
)
// Accept and handle new connections on this listener until it errors
go
func
()
{
for
{
...
...
@@ -172,6 +176,10 @@ func (s *Swarm) Close() {
}
s
.
Chan
.
Close
<-
true
// fan out
s
.
Chan
.
Close
<-
true
// listener
for
_
,
list
:=
range
s
.
listeners
{
list
.
Close
()
}
}
// Dial connects to a peer.
...
...
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