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
079bdbac
Commit
079bdbac
authored
Nov 11, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc(peer) question
parent
fba5db20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
peer/peerstore.go
peer/peerstore.go
+11
-0
No files found.
peer/peerstore.go
View file @
079bdbac
...
...
@@ -47,6 +47,17 @@ func (p *peerstore) Get(i ID) (Peer, error) {
// not found, construct it ourselves, add it to datastore, and return.
case
ds
.
ErrNotFound
:
// TODO(brian) kinda dangerous, no? If ID is invalid and doesn't
// correspond to an actual valid peer ID, this peerstore will return an
// instantiated peer value, allowing the error to propagate. It might
// be better to nip this at the bud by returning nil and making the
// client manually add a Peer. To keep the peerstore in control, this
// can even be a peerstore method that performs cursory validation.
//
// Potential bad case: Suppose values arrive from untrusted providers
// in the DHT.
peer
:=
&
peer
{
id
:
i
}
if
err
:=
p
.
peers
.
Put
(
k
,
peer
);
err
!=
nil
{
return
nil
,
err
...
...
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