-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish and Test the simultaneous connect problem in libp2p peers #1041
Conversation
config/security.go
Outdated
secMuxer := new(csms.SSMuxer) | ||
secMuxer.AddTransport(insecure.ID, insecure.NewWithIdentity(id, privKey)) | ||
return secMuxer | ||
} | ||
|
||
func makeSecurityTransport(h host.Host, tpts []MsSecC) (sec.SecureTransport, error) { | ||
func makeSecurityTransport(h host.Host, tpts []MsSecC) (sec.SecureMuxer, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makeSecurityMuxer
?
cc @vyzo Please can you give me a review ? |
for i := 0; i < 20; i++ { | ||
require.NoError(t, h1.Connect(context.Background(), h2Info)) | ||
require.NoError(t, h1.Network().ClosePeer(h2.ID())) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are 20 iterations sufficient to reliably trigger simopen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raulk Pretty much.
Here's a run of the same test against v0.13.0
(previous release, did not have hole punching), and it fails repeatedly:
aarshshah@Aarshs-MacBook-Pro go-libp2p % go test -run TestTcpSimultaneousConnect -count 10
--- FAIL: TestTcpSimultaneousConnect (0.28s)
libp2p_test.go:231:
Error Trace: libp2p_test.go:231
asm_amd64.s:1374
Error: Received unexpected error:
failed to dial QmZsP5W7ceKhynLcEtQpHXRTNTfd7i9YnBsnndwvmi5p3t: all dials failed
* [/ip4/192.168.43.87/tcp/50093] failed to negotiate security protocol: error reading handshake message: noise: message is too short
* [/ip4/127.0.0.1/tcp/50093] failed to negotiate security protocol: error reading handshake message: noise: message is too short
Test: TestTcpSimultaneousConnect
libp2p_test.go:241:
Error Trace: libp2p_test.go:241
asm_amd64.s:1374
Error: Received unexpected error:
failed to dial QmcMLKDi4aSWSkMk1W7pHY5uFiB6Wi7yKVzgVTY6oWL4an: all dials failed
* [/ip4/192.168.43.87/tcp/50092] failed to negotiate security protocol: error reading handshake message: noise: message is too short
* [/ip4/127.0.0.1/tcp/50092] failed to negotiate security protocol: error reading handshake message: noise: message is too short
Test: TestTcpSimultaneousConnect
--- FAIL: TestTcpSimultaneousConnect (0.23s)
libp2p_test.go:241:
Error Trace: libp2p_test.go:241
asm_amd64.s:1374
Error: Received unexpected error:
failed to dial Qmed9XqtjKjxEEoJi12PwKAf2NW35qkA6L2jffMEaodGQ2: all dials failed
* [/ip4/192.168.43.87/tcp/50095] failed to negotiate security protocol: error reading handshake message: noise: message is too short
* [/ip4/127.0.0.1/tcp/50095] failed to negotiate security protocol: error reading handshake message: noise: message is too short
Test: TestTcpSimultaneousConnect
libp2p_test.go:231:
Error Trace: libp2p_test.go:231
asm
...........................
...........................
FAIL
exit status 1
FAIL github.com/libp2p/go-libp2p 3.496s
Now, here's the same run with simultaneous connect feature:
aarshshah@Aarshs-MacBook-Pro go-libp2p % go test -run TestTcpSimultaneousConnect -count 10
go: downloading github.com/libp2p/go-libp2p-core v0.8.2
go: downloading github.com/libp2p/go-libp2p-transport-upgrader v0.4.2
go: downloading github.com/libp2p/go-libp2p-swarm v0.4.2
PASS
ok github.com/libp2p/go-libp2p 5.609s
Closes libp2p/go-libp2p-noise#70.
TODO