Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
railgun-routing-client
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-client
Commits
95846ae4
Commit
95846ae4
authored
Aug 30, 2022
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
d41f24ce
c5954785
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
src/Peer.ts
src/Peer.ts
+10
-2
No files found.
src/Peer.ts
View file @
95846ae4
...
@@ -28,6 +28,7 @@ export class Peer implements Hello, PeerQuality, RouterConfig {
...
@@ -28,6 +28,7 @@ export class Peer implements Hello, PeerQuality, RouterConfig {
reset
()
{
reset
()
{
this
.
delay
=
0
;
this
.
delay
=
0
;
this
.
reliability
=
0
;
this
.
reliability
=
0
;
this
.
jitter
=
0
;
this
.
seq
=
0
;
this
.
seq
=
0
;
this
.
time
=
0
;
this
.
time
=
0
;
this
.
history
=
[];
this
.
history
=
[];
...
@@ -59,6 +60,11 @@ export class Peer implements Hello, PeerQuality, RouterConfig {
...
@@ -59,6 +60,11 @@ export class Peer implements Hello, PeerQuality, RouterConfig {
this
.
reliability
=
history
.
length
/
config
.
history
;
this
.
reliability
=
history
.
length
/
config
.
history
;
this
.
delay
=
_
.
mean
(
history
)
||
0
;
this
.
delay
=
_
.
mean
(
history
)
||
0
;
let
jitterSum
=
0
;
for
(
let
i
=
0
;
i
<
history
.
length
-
1
;
i
++
)
{
jitterSum
[
i
]
+=
Math
.
abs
(
history
[
i
]
-
history
[
i
+
1
]);
}
this
.
jitter
=
(
jitterSum
/
history
.
length
-
1
)
||
0
;
this
.
seq
=
data
.
seq
;
this
.
seq
=
data
.
seq
;
this
.
time
=
time
;
this
.
time
=
time
;
...
@@ -73,10 +79,12 @@ export class Peer implements Hello, PeerQuality, RouterConfig {
...
@@ -73,10 +79,12 @@ export class Peer implements Hello, PeerQuality, RouterConfig {
}
}
}
}
const
lost
=
Math
.
max
(
0
,
(
time
-
this
.
time
)
/
config
.
interval
-
2
);
return
{
return
{
delay
:
Math
.
round
(
this
.
delay
),
delay
:
Math
.
round
(
this
.
delay
),
jitter
:
0
,
jitter
:
Math
.
round
(
this
.
jitter
)
,
reliability
:
this
.
reliability
reliability
:
Math
.
max
(
0
,
this
.
reliability
-
lost
/
config
.
history
)
};
};
}
}
}
}
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