mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 03:31:10 +00:00
Fix telemetry not responding to pings (#3272)
This commit is contained in:
committed by
Gavin Wood
parent
5b1b4b92b1
commit
780942192e
@@ -87,7 +87,7 @@ impl<TTrans: Transport> Node<TTrans> {
|
||||
|
||||
impl<TTrans: Transport, TSinkErr> Node<TTrans>
|
||||
where TTrans: Clone + Unpin, TTrans::Dial: Unpin,
|
||||
TTrans::Output: Sink<BytesMut, Error = TSinkErr> + Unpin, TSinkErr: fmt::Debug {
|
||||
TTrans::Output: Sink<BytesMut, Error = TSinkErr> + Stream + 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 +175,7 @@ fn gen_rand_reconnect_delay() -> Delay {
|
||||
}
|
||||
|
||||
impl<TTrans: Transport, TSinkErr> NodeSocketConnected<TTrans>
|
||||
where TTrans::Output: Sink<BytesMut, Error = TSinkErr> + Unpin {
|
||||
where TTrans::Output: Sink<BytesMut, Error = TSinkErr> + Stream + Unpin {
|
||||
/// Processes the queue of messages for the connected socket.
|
||||
///
|
||||
/// The address is passed for logging purposes only.
|
||||
@@ -200,6 +200,7 @@ where TTrans::Output: Sink<BytesMut, Error = TSinkErr> + Unpin {
|
||||
item_len, my_addr
|
||||
);
|
||||
self.need_flush = true;
|
||||
|
||||
} else if self.need_flush {
|
||||
match Sink::poll_flush(Pin::new(&mut self.sink), cx) {
|
||||
Poll::Pending => return Poll::Pending,
|
||||
@@ -207,6 +208,11 @@ where TTrans::Output: Sink<BytesMut, Error = TSinkErr> + 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user