Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1286 +/- ##
===========================================
- Coverage 60.58% 60.53% -0.06%
===========================================
Files 112 112
Lines 10863 10902 +39
===========================================
+ Hits 6581 6599 +18
- Misses 3644 3657 +13
- Partials 638 646 +8
|
types/priv_validator/socket.go
Outdated
|
|
||
| // OnStart implements cmn.Service. | ||
| func (sc *SocketClient) OnStart() error { | ||
| if err := sc.BaseService.OnStart(); err != nil { |
There was a problem hiding this comment.
BaseService.OnStart is empty and can be removed
|
|
||
| RETRY_LOOP: | ||
| for retries > 0 { | ||
| if retries != defaultDialRetries { |
There was a problem hiding this comment.
I'd add a comment like sleep if it's not our first retry
5dc1561 to
5897817
Compare
Follow-up to #1255 aligning with the expectation that the external signing process connects to the node. The SocketClient will block on start until one connection has been established, support for multiple signers connected simultaneously is a planned future extension. * SocketClient accepts connection * PrivValSocketServer renamed to RemoteSigner * extend tests
| func (sc *SocketClient) OnStart() error { | ||
| if err := sc.BaseService.OnStart(); err != nil { | ||
| return err | ||
| if sc.listener == nil { |
There was a problem hiding this comment.
dont think we need this check.
| } | ||
|
|
||
| continue RETRY_LOOP | ||
| if sc.privKey != nil { |
There was a problem hiding this comment.
lets require the privKey always :)
| return | ||
| } | ||
|
|
||
| connc <- conn |
There was a problem hiding this comment.
should we include a way to exit this routine if the timeout triggerS ?
| for { | ||
| conn, err := pvss.listener.Accept() | ||
| func (rs *RemoteSigner) connect() (net.Conn, error) { | ||
| retries := defaultDialRetries |
| retries := defaultDialRetries | ||
|
|
||
| RETRY_LOOP: | ||
| for retries > 0 { |
There was a problem hiding this comment.
lets put the retries := and the retries -- in the one liner
| RETRY_LOOP: | ||
| for retries > 0 { | ||
| // Don't sleep if it is the first retry. | ||
| if retries != defaultDialRetries { |
|
|
||
| if pvss.privKey != nil { | ||
| conn, err = p2pconn.MakeSecretConnection(conn, pvss.privKey.Wrap()) | ||
| if rs.privKey != nil { |
There was a problem hiding this comment.
we also probably want to authenticate. ie. we should be dialing a ID@host:port and then after the secret connection is setup, check that the ID (ie. hash of the remote pubkey) of the connection matches the ID we dialed (see how p2p does it)
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
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
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
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
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
Follow-up to #1255 aligning with the expectation that the external signing process connects to the node. The SocketClient will block on start until one connection has been established, support for multiple signers connected simultaneously is a planned future extension.