Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
railgun-routing-server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
railgun-routing-server
Commits
f14d907a
Commit
f14d907a
authored
Dec 21, 2025
by
nanamicat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean
parent
473945aa
Pipeline
#42112
passed with stages
in 2 minutes and 43 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
src/main.rs
src/main.rs
+5
-5
src/router.rs
src/router.rs
+14
-14
No files found.
src/main.rs
View file @
f14d907a
...
...
@@ -79,7 +79,7 @@ async fn main() -> Result<()> {
let
mut
routers
=
routers
.write
()
.await
;
if
let
Some
(
router
)
=
routers
.get_mut
(
&
report
.id
)
{
if
let
Some
(
change
)
=
router
.on_message
(
report
,
addr
,
&
mut
updating
)
{
println!
(
"2.{} {}"
,
router
.id
,
serde_json
::
to_string
(
&
change
)
?
);
//
println!("2.{} {}", router.id, serde_json::to_string(&change)?);
let
len
=
bincode
::
encode_into_slice
(
change
,
&
mut
buf
,
bincode
::
config
::
standard
())
?
;
let
_
=
socket
.send_to
(
&
buf
[
..
len
],
addr
)
.await
;
router
.seq
+=
1
;
...
...
@@ -93,11 +93,11 @@ async fn main() -> Result<()> {
if
updating
.router_id
!=
0
{
let
router
=
routers
.get_mut
(
&
updating
.router_id
)
.expect
(
"updating router_id should exist"
);
if
now
.duration_since
(
router
.time
)
<
TIMEOUT
{
println!
(
"3.{}"
,
serde_json
::
to_string
(
&
updating
)
?
);
//
println!("3.{}", serde_json::to_string(&updating)?);
let
len
=
bincode
::
encode_into_slice
(
&
updating
.change
,
&
mut
buf
,
bincode
::
config
::
standard
())
?
;
let
_
=
socket
.send_to
(
&
buf
[
..
len
],
router
.addr
.unwrap
())
.await
;
}
else
{
println!
(
"1"
);
//
println!("1");
router
.offline
();
router
.finish
(
&
mut
updating
);
}
...
...
@@ -105,14 +105,14 @@ async fn main() -> Result<()> {
if
updating
.router_id
==
0
{
for
router
in
routers
.values_mut
()
{
if
router
.addr
!=
None
&&
now
.duration_since
(
router
.time
)
>
TIMEOUT
{
println!
(
"2"
);
//
println!("2");
router
.offline
();
}
}
if
let
Some
((
router
,
change
))
=
routers
.values
()
.find_map
(|
r
|
r
.update
(
&
routers
,
&
connections
)
.map
(|
change
|(
r
,
change
)))
{
updating
.router_id
=
router
.id
;
updating
.change
=
change
;
println!
(
"1.{}"
,
serde_json
::
to_string
(
&
updating
)
?
);
//
println!("1.{}", serde_json::to_string(&updating)?);
let
len
=
bincode
::
encode_into_slice
(
&
updating
.change
,
&
mut
buf
,
bincode
::
config
::
standard
())
?
;
let
_
=
socket
.send_to
(
&
buf
[
..
len
],
router
.addr
.unwrap
())
.await
;
}
...
...
src/router.rs
View file @
f14d907a
...
...
@@ -89,11 +89,11 @@ impl Router {
None
}
(
false
,
_
,
_
,
_
)
|
(
true
,
true
,
true
,
_
)
=>
{
if
self
.addr
==
None
{
println!
(
"3.0"
);
}
else
{
println!
(
"3.1"
);
}
//
if self.addr == None {
//
println!("3.0");
//
} else {
//
println!("3.1");
//
}
self
.offline
();
self
.finish
(
updating
);
...
...
@@ -118,15 +118,15 @@ impl Router {
None
}
_
=>
{
println!
(
"???, {}, {}, {}, {}, {} != {}"
,
self
.addr
!=
None
,
data
.syn
,
data
.peers
.len
()
!=
0
,
data
.ack
==
self
.seq
.wrapping_add
(
1
),
data
.ack
,
self
.seq
);
//
println!(
//
"???, {}, {}, {}, {}, {} != {}",
//
self.addr != None,
//
data.syn,
//
data.peers.len() != 0,
//
data.ack == self.seq.wrapping_add(1),
//
data.ack,
//
self.seq
//
);
None
}
}
...
...
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