gossipd: give more distinct errors.

At least say whether we failed to connect at all, or failed cryptographic
handshake, or failed reading/writing init messages.

The errno can be "Operation now in progress" if the other end closes the
socket on us: this happens when we handshake with the wrong key and it
hangs up on us.  Fixing this would require work on ccan/io though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-04-26 14:21:01 +09:30
parent e72e54f8d1
commit c6483a57d0
3 changed files with 21 additions and 1 deletions

View File

@@ -623,6 +623,16 @@ class LightningDTests(BaseLightningDTests):
"No address known",
l1.rpc.connect, '032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e')
# Should get reasonable error if connection refuse.
self.assertRaisesRegex(ValueError,
"Connection establishment: Connection refused",
l1.rpc.connect, '032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e', 'localhost', 1)
# Should get reasonable error if wrong key for peer.
self.assertRaisesRegex(ValueError,
"Cryptographic handshake: ",
l1.rpc.connect, '032cf15d1ad9c4a08d26eab1918f732d8ef8fdc6abb9640bf3db174372c491304e', 'localhost', l2.info['port'])
def test_connect_standard_addr(self):
"""Test standard node@host:port address
"""