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
a8c31fdf
Commit
a8c31fdf
authored
Jul 13, 2014
by
Jakob Borg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New port number for new format global discovery
parent
e825abf6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
main.go
main.go
+7
-7
No files found.
main.go
View file @
a8c31fdf
...
...
@@ -53,7 +53,7 @@ func main() {
var
statsIntv
int
var
statsFile
string
flag
.
StringVar
(
&
listen
,
"listen"
,
":2202
5
"
,
"Listen address"
)
flag
.
StringVar
(
&
listen
,
"listen"
,
":2202
6
"
,
"Listen address"
)
flag
.
BoolVar
(
&
debug
,
"debug"
,
false
,
"Enable debug output"
)
flag
.
BoolVar
(
&
timestamp
,
"timestamp"
,
true
,
"Timestamp the log output"
)
flag
.
IntVar
(
&
statsIntv
,
"stats-intv"
,
0
,
"Statistics output interval (s)"
)
...
...
@@ -103,10 +103,10 @@ func main() {
magic
:=
binary
.
BigEndian
.
Uint32
(
buf
)
switch
magic
{
case
discover
.
AnnouncementMagic
V2
:
case
discover
.
AnnouncementMagic
:
handleAnnounceV2
(
addr
,
buf
)
case
discover
.
QueryMagic
V2
:
case
discover
.
QueryMagic
:
handleQueryV2
(
conn
,
addr
,
buf
)
default
:
...
...
@@ -146,7 +146,7 @@ func limit(addr *net.UDPAddr) bool {
}
func
handleAnnounceV2
(
addr
*
net
.
UDPAddr
,
buf
[]
byte
)
{
var
pkt
discover
.
Announce
V2
var
pkt
discover
.
Announce
err
:=
pkt
.
UnmarshalXDR
(
buf
)
if
err
!=
nil
&&
err
!=
io
.
EOF
{
log
.
Println
(
"AnnounceV2 Unmarshal:"
,
err
)
...
...
@@ -197,7 +197,7 @@ func handleAnnounceV2(addr *net.UDPAddr, buf []byte) {
}
func
handleQueryV2
(
conn
*
net
.
UDPConn
,
addr
*
net
.
UDPAddr
,
buf
[]
byte
)
{
var
pkt
discover
.
Query
V2
var
pkt
discover
.
Query
err
:=
pkt
.
UnmarshalXDR
(
buf
)
if
err
!=
nil
{
log
.
Println
(
"QueryV2 Unmarshal:"
,
err
)
...
...
@@ -222,8 +222,8 @@ func handleQueryV2(conn *net.UDPConn, addr *net.UDPAddr, buf []byte) {
lock
.
Unlock
()
if
ok
&&
len
(
node
.
addresses
)
>
0
{
ann
:=
discover
.
Announce
V2
{
Magic
:
discover
.
AnnouncementMagic
V2
,
ann
:=
discover
.
Announce
{
Magic
:
discover
.
AnnouncementMagic
,
This
:
discover
.
Node
{
ID
:
pkt
.
NodeID
,
},
...
...
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