Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
discosrv
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Ind.ie Projects
discosrv
Commits
bb697c93
Commit
bb697c93
authored
Sep 28, 2014
by
Jakob Borg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Node -> Device here too
parent
dab9271d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
main.go
main.go
+9
-9
No files found.
main.go
View file @
bb697c93
...
...
@@ -213,7 +213,7 @@ func handleAnnounceV2(db *leveldb.DB, addr *net.UDPAddr, buf []byte) error {
})
}
var
id
protocol
.
Nod
eID
var
id
protocol
.
Devic
eID
if
len
(
pkt
.
This
.
ID
)
==
32
{
// Raw node ID
copy
(
id
[
:
],
pkt
.
This
.
ID
)
...
...
@@ -238,12 +238,12 @@ func handleQueryV2(db *leveldb.DB, conn *net.UDPConn, addr *net.UDPAddr, buf []b
log
.
Printf
(
"<- %v %#v"
,
addr
,
pkt
)
}
var
id
protocol
.
Nod
eID
if
len
(
pkt
.
Nod
eID
)
==
32
{
var
id
protocol
.
Devic
eID
if
len
(
pkt
.
Devic
eID
)
==
32
{
// Raw node ID
copy
(
id
[
:
],
pkt
.
Nod
eID
)
copy
(
id
[
:
],
pkt
.
Devic
eID
)
}
else
{
err
=
id
.
UnmarshalText
(
pkt
.
Nod
eID
)
err
=
id
.
UnmarshalText
(
pkt
.
Devic
eID
)
if
err
!=
nil
{
return
err
}
...
...
@@ -259,8 +259,8 @@ func handleQueryV2(db *leveldb.DB, conn *net.UDPConn, addr *net.UDPAddr, buf []b
if
len
(
addrs
)
>
0
{
ann
:=
discover
.
Announce
{
Magic
:
discover
.
AnnouncementMagic
,
This
:
discover
.
Nod
e
{
ID
:
pkt
.
Nod
eID
,
This
:
discover
.
Devic
e
{
ID
:
pkt
.
Devic
eID
,
},
}
for
_
,
addr
:=
range
addrs
{
...
...
@@ -318,7 +318,7 @@ func logStats(statsLog io.Writer, intv int) {
}
}
func
get
(
db
*
leveldb
.
DB
,
id
protocol
.
Nod
eID
)
[]
address
{
func
get
(
db
*
leveldb
.
DB
,
id
protocol
.
Devic
eID
)
[]
address
{
var
addrs
addressList
val
,
err
:=
db
.
Get
(
id
[
:
],
nil
)
if
err
==
nil
{
...
...
@@ -327,7 +327,7 @@ func get(db *leveldb.DB, id protocol.NodeID) []address {
return
addrs
.
addresses
}
func
update
(
db
*
leveldb
.
DB
,
id
protocol
.
Nod
eID
,
addrs
[]
address
)
{
func
update
(
db
*
leveldb
.
DB
,
id
protocol
.
Devic
eID
,
addrs
[]
address
)
{
var
newAddrs
addressList
val
,
err
:=
db
.
Get
(
id
[
:
],
nil
)
...
...
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