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
ac5a65b5
Commit
ac5a65b5
authored
Jan 10, 2026
by
nanamicat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean
parent
59c52ce0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
src/router.rs
src/router.rs
+9
-4
No files found.
src/router.rs
View file @
ac5a65b5
...
...
@@ -88,6 +88,13 @@ impl Router {
self
.addr
.is_some
()
}
pub
fn
apply
(
&
mut
self
,
via
:
&
mut
BTreeMap
<
RouterID
,
RouterID
>
,
plan
:
&
mut
BTreeMap
<
RegionID
,
BTreeMap
<
GatewayGroupID
,
GatewayID
>>
)
{
self
.via
.append
(
via
);
for
(
region
,
mut
plan
)
in
std
::
mem
::
take
(
plan
)
{
self
.plan
.entry
(
region
)
.or_default
()
.append
(
&
mut
plan
);
}
}
pub
fn
on_message
(
&
mut
self
,
uplink
:
&
mut
Uplink
,
addr
:
SocketAddr
,
updating
:
&
mut
UpdatingState
,
now
:
Instant
)
->
Option
<
Downlink
>
{
if
uplink
.peers
.len
()
==
self
.peers
.len
()
{
for
(
current
,
new
)
in
self
.peers
.values_mut
()
.zip
(
&
mut
uplink
.peers
)
{
...
...
@@ -110,8 +117,7 @@ impl Router {
for
(
to
,
via
)
in
self
.via
.iter_mut
()
{
*
via
=
*
to
;
}
self
.via
.append
(
&
mut
uplink
.via
);
self
.plan
.append
(
&
mut
uplink
.plan
);
self
.apply
(
&
mut
uplink
.via
,
&
mut
uplink
.plan
);
self
.online
(
addr
,
now
);
}
None
...
...
@@ -121,8 +127,7 @@ impl Router {
self
.online
(
addr
,
now
);
if
updating
.router_id
==
self
.id
{
updating
.router_id
=
Default
::
default
();
self
.via
.append
(
&
mut
updating
.message.via
);
self
.plan
.append
(
&
mut
updating
.message.plan
);
self
.apply
(
&
mut
updating
.message.via
,
&
mut
updating
.message.plan
);
self
.last_update
=
now
;
}
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