lnrpc+itest: fix write deadline issue with WS ping

Fixes #5680.
To make sure we're always reading from the WebSocket connection, we need
to always have an ongoing (but blocking) conn.ReadMessage() call going
on. To achieve this, we do the read in a separate goroutine and write to
a buffered channel. That way we can always read the next message while
the current one is being forwarded. This allows incoming ping messages
to be received and processed which then leads to the deadlines to be
extended correctly.
This commit is contained in:
Oliver Gugger
2021-08-31 13:23:35 +02:00
parent 5f94ebbd7d
commit 4b7452a35e
3 changed files with 179 additions and 8 deletions

View File

@@ -324,6 +324,12 @@ you.
* [Fix crash with empty AMP or MPP record in
invoice](https://github.com/lightningnetwork/lnd/pull/5743).
* The underlying gRPC connection of a WebSocket is now [properly closed when the
WebSocket end of a connection is
closed](https://github.com/lightningnetwork/lnd/pull/5683). A bug with the
write deadline that caused connections to suddenly break was also fixed in the
same PR.
## Documentation
The [code contribution guidelines have been updated to mention the new