Skip to content
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

Merged
merged 2 commits into from
Feb 17, 2021

Conversation

aarshkshah1992
Copy link
Contributor

@aarshkshah1992 aarshkshah1992 commented Jan 27, 2021

Closes libp2p/go-libp2p-noise#70.

TODO

  • Update Deps and then merge.

@aarshkshah1992 aarshkshah1992 changed the title Finish and Test the simultaneous open problem in libp2p peers Finish and Test the simultaneous connect problem in libp2p peers Jan 27, 2021
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makeSecurityMuxer?

@aarshkshah1992
Copy link
Contributor Author

cc @vyzo Please can you give me a review ?

@aarshkshah1992 aarshkshah1992 merged commit c575ec4 into master Feb 17, 2021
@aarshkshah1992 aarshkshah1992 deleted the feat/finish-sim-open branch February 17, 2021 08:06
Comment on lines +230 to +233
for i := 0; i < 20; i++ {
require.NoError(t, h1.Connect(context.Background(), h2Info))
require.NoError(t, h1.Network().ClosePeer(h2.ID()))
}
Copy link
Member

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?

Copy link
Contributor Author

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

@Stebalien Stebalien mentioned this pull request May 11, 2021
27 tasks
@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Peers Cannot Successfully Handshake
4 participants