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
6a4fe011
Unverified
Commit
6a4fe011
authored
Sep 04, 2018
by
bigs
Committed by
GitHub
Sep 04, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74 from libp2p/feat/log-no-transports
log an error when we have no transports configured
parents
67b383f9
486c6372
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
swarm_transport.go
swarm_transport.go
+10
-0
No files found.
swarm_transport.go
View file @
6a4fe011
...
@@ -18,6 +18,11 @@ func (s *Swarm) TransportForDialing(a ma.Multiaddr) transport.Transport {
...
@@ -18,6 +18,11 @@ func (s *Swarm) TransportForDialing(a ma.Multiaddr) transport.Transport {
s
.
transports
.
RLock
()
s
.
transports
.
RLock
()
defer
s
.
transports
.
RUnlock
()
defer
s
.
transports
.
RUnlock
()
if
len
(
s
.
transports
.
m
)
==
0
{
log
.
Error
(
"you have no transports configured"
)
return
nil
}
for
_
,
p
:=
range
protocols
{
for
_
,
p
:=
range
protocols
{
transport
,
ok
:=
s
.
transports
.
m
[
p
.
Code
]
transport
,
ok
:=
s
.
transports
.
m
[
p
.
Code
]
if
!
ok
{
if
!
ok
{
...
@@ -41,6 +46,11 @@ func (s *Swarm) TransportForListening(a ma.Multiaddr) transport.Transport {
...
@@ -41,6 +46,11 @@ func (s *Swarm) TransportForListening(a ma.Multiaddr) transport.Transport {
s
.
transports
.
RLock
()
s
.
transports
.
RLock
()
defer
s
.
transports
.
RUnlock
()
defer
s
.
transports
.
RUnlock
()
if
len
(
s
.
transports
.
m
)
==
0
{
log
.
Error
(
"you have no transports configured"
)
return
nil
}
selected
:=
s
.
transports
.
m
[
protocols
[
len
(
protocols
)
-
1
]
.
Code
]
selected
:=
s
.
transports
.
m
[
protocols
[
len
(
protocols
)
-
1
]
.
Code
]
for
_
,
p
:=
range
protocols
{
for
_
,
p
:=
range
protocols
{
transport
,
ok
:=
s
.
transports
.
m
[
p
.
Code
]
transport
,
ok
:=
s
.
transports
.
m
[
p
.
Code
]
...
...
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