privVal: Improve SocketClient network code#1315
Merged
Conversation
6f530a7 to
64a0717
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1315 +/- ##
==========================================
Coverage ? 60.62%
==========================================
Files ? 113
Lines ? 10970
Branches ? 0
==========================================
Hits ? 6651
Misses ? 3674
Partials ? 645
|
64a0717 to
90bc52a
Compare
melekes
reviewed
Mar 15, 2018
types/priv_validator/socket.go
Outdated
|
|
||
| // OnStop implements cmn.Service. | ||
| func (sc *SocketClient) OnStop() { | ||
| sc.BaseService.OnStop() |
melekes
reviewed
Mar 15, 2018
types/priv_validator/socket.go
Outdated
| ErrConnWaitTimeout = errors.New("Error waiting for external connection") | ||
| ErrConnTimeout = errors.New("Error connection timed out") | ||
| ErrDialRetryMax = errors.New("dialed maximum retries") | ||
| ErrConnWaitTimeout = errors.New("waited for remote signer timed out") |
Contributor
There was a problem hiding this comment.
maybe "waited for remote signer for too long" or smth else?
melekes
reviewed
Mar 15, 2018
types/priv_validator/socket_tcp.go
Outdated
|
|
||
| // tcpTimeoutListener wraps a *net.TCPListener to standardise protocol timeouts | ||
| // and potentially other tuning parameters. | ||
| // Implements net.Listener. |
Contributor
There was a problem hiding this comment.
you can check that in compile time var _ net.Listener = (*tcpTimeoutListener)(nil)
melekes
reviewed
Mar 15, 2018
types/priv_validator/socket_tcp.go
Outdated
| period time.Duration | ||
| } | ||
|
|
||
| // tcpTimeoutListener wraps a *net.TCPListener to standardise protocol timeouts |
xla
commented
Mar 15, 2018
types/priv_validator/socket_test.go
Outdated
|
|
||
| readyc <- struct{}{} | ||
| require.NoError(t, sc.Start()) | ||
| defer sc.Stop() |
Contributor
Author
There was a problem hiding this comment.
remove this and add a sleep somewhere
Follow-up to feedback from #1286, this change simplifies the connection handling in the SocketClient and makes the communication via TCP more robust. It introduces the tcpTimeoutListener to encapsulate accept and i/o timeout handling as well as connection keep-alive, this type could likely be upgraded to handle more fine-grained tuning of the tcp stack (linger, nodelay, etc.) according to the properties we desire. The same methods should be applied to the RemoteSigner which will be overhauled when the priv_val_server is fleshed out. * require private key * simplify connect logic * break out conn upgrades to tcpTimeoutListener * extend test coverage and simplify component setup
b1db841 to
6b380ee
Compare
melekes
approved these changes
Mar 16, 2018
cboh4
pushed a commit
to scrtlabs/tendermint
that referenced
this pull request
Apr 7, 2025
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sergio Mena <sergio@informal.systems>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to feedback from #1286, this change simplifies the connection handling in the SocketClient and makes the communication via TCP more robust. It introduces the tcpTimeoutListener to encapsulate accept and i/o timeout handling as well as connection keep-alive, this type could likely be upgraded to handle more fine-grained tuning of the tcp stack (linger, nodelay, etc.) according to the properties we desire. The same methods should be applied to the RemoteSigner which will be overhauled when the priv_val_server is fleshed out.
tcpTimeoutListenerBelongs to #1255 with the original issue being #1307