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
e2a3c4d1
Commit
e2a3c4d1
authored
Feb 02, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(gcr/s) re-use code from get
parent
31eb4cac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
routing/grandcentral/server.go
routing/grandcentral/server.go
+4
-9
No files found.
routing/grandcentral/server.go
View file @
e2a3c4d1
...
...
@@ -134,16 +134,11 @@ func putRoutingRecord(ds datastore.Datastore, k util.Key, value *dhtpb.Record) e
func
putRoutingProviders
(
ds
datastore
.
Datastore
,
k
util
.
Key
,
providers
[]
*
dhtpb
.
Message_Peer
)
error
{
log
.
Event
(
context
.
Background
(),
"putRoutingProviders"
,
&
k
)
pkey
:=
datastore
.
KeyWithNamespaces
([]
string
{
"routing"
,
"providers"
,
k
.
String
()})
if
v
,
err
:=
ds
.
Get
(
pkey
);
err
==
nil
{
if
msg
,
ok
:=
v
.
([]
byte
);
ok
{
var
protomsg
dhtpb
.
Message
if
err
:=
proto
.
Unmarshal
(
msg
,
&
protomsg
);
err
!=
nil
{
log
.
Error
(
"failed to unmarshal routing provider record. programmer error"
)
}
else
{
providers
=
append
(
providers
,
protomsg
.
ProviderPeers
...
)
}
}
old
,
err
:=
getRoutingProviders
(
ds
,
k
)
if
err
!=
nil
{
return
err
}
providers
=
append
(
providers
,
old
...
)
var
protomsg
dhtpb
.
Message
protomsg
.
ProviderPeers
=
providers
data
,
err
:=
proto
.
Marshal
(
&
protomsg
)
...
...
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