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-connmgr
Commits
eb0e1cac
Commit
eb0e1cac
authored
Jun 03, 2020
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement IsProtected interface
parent
d9da1ff6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
connmgr.go
connmgr.go
+17
-0
No files found.
connmgr.go
View file @
eb0e1cac
...
...
@@ -176,6 +176,23 @@ func (cm *BasicConnMgr) Unprotect(id peer.ID, tag string) (protected bool) {
return
true
}
func
(
cm
*
BasicConnMgr
)
IsProtected
(
id
peer
.
ID
,
tag
string
)
(
protected
bool
)
{
cm
.
plk
.
Lock
()
defer
cm
.
plk
.
Unlock
()
tags
,
ok
:=
cm
.
protected
[
id
]
if
!
ok
{
return
false
}
if
tag
==
""
{
return
true
}
_
,
protected
=
tags
[
tag
]
return
protected
}
// peerInfo stores metadata for a given peer.
type
peerInfo
struct
{
id
peer
.
ID
...
...
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