good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
0fef66c7
Unverified
Commit
0fef66c7
authored
4 years ago
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
ethstats: fix reconnection issue, implement primus pings
parent
9e88224e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ethstats/ethstats.go
+19
-2
19 additions, 2 deletions
ethstats/ethstats.go
with
19 additions
and
2 deletions
ethstats/ethstats.go
+
19
−
2
View file @
0fef66c7
...
...
@@ -280,8 +280,10 @@ func (s *Service) loop() {
}
}
fullReport
.
Stop
()
// Make sure the connection is closed
// Close the current connection and establish a new one
conn
.
Close
()
errTimer
.
Reset
(
0
)
}
}
}
...
...
@@ -296,8 +298,23 @@ func (s *Service) readLoop(conn *websocket.Conn) {
for
{
// Retrieve the next generic network packet and bail out on error
var
blob
json
.
RawMessage
if
err
:=
conn
.
ReadJSON
(
&
blob
);
err
!=
nil
{
log
.
Warn
(
"Failed to retrieve stats server message"
,
"err"
,
err
)
return
}
// If the network packet is a system ping, respond to it directly
var
ping
string
if
err
:=
json
.
Unmarshal
(
blob
,
&
ping
);
err
==
nil
&&
strings
.
HasPrefix
(
ping
,
"primus::ping::"
)
{
if
err
:=
conn
.
WriteJSON
(
strings
.
Replace
(
ping
,
"ping"
,
"pong"
,
-
1
));
err
!=
nil
{
log
.
Warn
(
"Failed to respond to system ping message"
,
"err"
,
err
)
return
}
continue
}
// Not a system ping, try to decode an actual state message
var
msg
map
[
string
][]
interface
{}
if
err
:=
conn
.
ReadJSON
(
&
msg
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
blob
,
&
msg
);
err
!=
nil
{
log
.
Warn
(
"Failed to decode stats server message"
,
"err"
,
err
)
return
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment