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
p2p
go-p2p-swarm
Commits
8be680ae
Unverified
Commit
8be680ae
authored
Jun 06, 2019
by
Steven Allen
Committed by
GitHub
Jun 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #131 from libp2p/fix/noisy
logging: make the swarm less noisy
parents
35dc0732
9c7976e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
swarm.go
swarm.go
+5
-0
swarm_listen.go
swarm_listen.go
+8
-3
No files found.
swarm.go
View file @
8be680ae
...
...
@@ -116,6 +116,11 @@ func NewSwarm(ctx context.Context, local peer.ID, peers peerstore.Peerstore, bwc
}
func
(
s
*
Swarm
)
teardown
()
error
{
// Wait for the context to be canceled.
// This allows other parts of the swarm to detect that we're shutting
// down.
<-
s
.
ctx
.
Done
()
// Prevents new connections and/or listeners from being added to the swarm.
s
.
listeners
.
Lock
()
...
...
swarm_listen.go
View file @
8be680ae
...
...
@@ -79,6 +79,7 @@ func (s *Swarm) AddListenAddr(a ma.Multiaddr) error {
c
,
err
:=
list
.
Accept
()
if
err
!=
nil
{
if
s
.
ctx
.
Err
()
==
nil
{
// only log if the swarm is still running.
log
.
Errorf
(
"swarm listener accept error: %s"
,
err
)
}
return
...
...
@@ -88,9 +89,13 @@ func (s *Swarm) AddListenAddr(a ma.Multiaddr) error {
go
func
()
{
defer
s
.
refs
.
Done
()
_
,
err
:=
s
.
addConn
(
c
,
network
.
DirInbound
)
if
err
!=
nil
{
// Probably just means that the swarm has been closed.
log
.
Warningf
(
"add conn failed: "
,
err
)
switch
err
{
case
nil
:
case
ErrSwarmClosed
:
// ignore.
return
default
:
log
.
Warningf
(
"add conn %s failed: "
,
err
)
return
}
}()
...
...
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