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
811124a5
Commit
811124a5
authored
Jan 07, 2026
by
nanamicat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
90631bcb
Pipeline
#42449
passed with stages
in 2 minutes and 52 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
src/router.rs
src/router.rs
+12
-7
No files found.
src/router.rs
View file @
811124a5
...
...
@@ -77,12 +77,20 @@ impl Router {
self
.addr
.is_some
()
}
pub
fn
on_message
(
&
mut
self
,
uplink
:
&
mut
Uplink
,
addr
:
SocketAddr
,
updating
:
&
mut
UpdatingState
,
now
:
Instant
)
->
Option
<
Downlink
>
{
match
uplink
.action
{
MessageType
::
Query
=>
{
pub
fn
apply_peers
(
&
mut
self
,
uplink
:
&
mut
Uplink
)
{
if
uplink
.peers
.len
()
==
self
.peers
.len
()
{
for
(
current
,
new
)
in
self
.peers
.values_mut
()
.zip
(
&
mut
uplink
.peers
)
{
*
current
=
*
new
}
}
else
if
uplink
.peers
.len
()
!=
0
{
tracing
::
error!
(
"router {} peers count wrong. local {} remote {}"
,
self
.id
,
self
.peers
.len
(),
uplink
.peers
.len
());
}
}
pub
fn
on_message
(
&
mut
self
,
uplink
:
&
mut
Uplink
,
addr
:
SocketAddr
,
updating
:
&
mut
UpdatingState
,
now
:
Instant
)
->
Option
<
Downlink
>
{
match
uplink
.action
{
MessageType
::
Query
=>
{
self
.apply_peers
(
uplink
);
Some
(
Downlink
{
action
:
MessageType
::
Full
,
version
:
self
.version
,
...
...
@@ -97,14 +105,11 @@ impl Router {
self
.via
.append
(
&
mut
uplink
.via
);
self
.plan
.append
(
&
mut
uplink
.plan
);
self
.online
(
addr
,
now
);
tracing
::
info!
(
"router {} full via={:?}"
,
self
.id
,
self
.via
);
}
None
}
MessageType
::
Update
=>
{
for
(
current
,
new
)
in
self
.peers
.values_mut
()
.zip
(
&
mut
uplink
.peers
)
{
*
current
=
*
new
}
self
.apply_peers
(
uplink
);
if
uplink
.version
==
self
.version
{
self
.online
(
addr
,
now
);
if
updating
.router_id
==
self
.id
{
...
...
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