Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package 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
parity
Mirrored projects
polkadot-sdk
Commits
b5cd3628
Commit
b5cd3628
authored
5 years ago
by
Arkadiy Paronyan
Committed by
Gavin Wood
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Handle telemetry socket errors (#3321)
* Handle telemetry socket errors * Line width
parent
3cb55770
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/core/telemetry/src/worker/node.rs
+20
-8
20 additions, 8 deletions
substrate/core/telemetry/src/worker/node.rs
with
20 additions
and
8 deletions
substrate/core/telemetry/src/worker/node.rs
+
20
−
8
View file @
b5cd3628
...
...
@@ -87,7 +87,11 @@ impl<TTrans: Transport> Node<TTrans> {
impl
<
TTrans
:
Transport
,
TSinkErr
>
Node
<
TTrans
>
where
TTrans
:
Clone
+
Unpin
,
TTrans
::
Dial
:
Unpin
,
TTrans
::
Output
:
Sink
<
BytesMut
,
Error
=
TSinkErr
>
+
Stream
+
Unpin
,
TSinkErr
:
fmt
::
Debug
{
TTrans
::
Output
:
Sink
<
BytesMut
,
Error
=
TSinkErr
>
+
Stream
<
Item
=
Result
<
BytesMut
,
TSinkErr
>>
+
Unpin
,
TSinkErr
:
fmt
::
Debug
{
/// Sends a WebSocket frame to the node. Returns an error if we are not connected to the node.
///
/// After calling this method, you should call `poll` in order for it to be properly processed.
...
...
@@ -175,7 +179,10 @@ fn gen_rand_reconnect_delay() -> Delay {
}
impl
<
TTrans
:
Transport
,
TSinkErr
>
NodeSocketConnected
<
TTrans
>
where
TTrans
::
Output
:
Sink
<
BytesMut
,
Error
=
TSinkErr
>
+
Stream
+
Unpin
{
where
TTrans
::
Output
:
Sink
<
BytesMut
,
Error
=
TSinkErr
>
+
Stream
<
Item
=
Result
<
BytesMut
,
TSinkErr
>>
+
Unpin
{
/// Processes the queue of messages for the connected socket.
///
/// The address is passed for logging purposes only.
...
...
@@ -208,13 +215,18 @@ where TTrans::Output: Sink<BytesMut, Error = TSinkErr> + Stream + Unpin {
Poll
::
Ready
(
Ok
(()))
=>
self
.need_flush
=
false
,
}
}
else
if
let
Poll
::
Ready
(
_
)
=
Stream
::
poll_next
(
Pin
::
new
(
&
mut
self
.sink
),
cx
)
{
// We poll the telemetry `Stream` because the underlying implementation relies on
// this in order to answer PINGs.
// We don't do anything with incoming messages, however.
}
else
{
break
match
Stream
::
poll_next
(
Pin
::
new
(
&
mut
self
.sink
),
cx
)
{
Poll
::
Ready
(
Some
(
Ok
(
_
)))
=>
{
// We poll the telemetry `Stream` because the underlying implementation relies on
// this in order to answer PINGs.
// We don't do anything with incoming messages, however.
},
Poll
::
Ready
(
Some
(
Err
(
err
)))
=>
{
return
Poll
::
Ready
(
Err
(
err
))
},
Poll
::
Pending
|
Poll
::
Ready
(
None
)
=>
break
,
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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