Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

feat: add DisableReuseport option #272

Closed
wants to merge 2 commits into from

Conversation

gfanton
Copy link
Contributor

@gfanton gfanton commented May 4, 2022

Fixes libp2p/go-libp2p#1428

Hey, I just started to add the DisableReuseport options. It seems to be working as expected with some cellular operators that couldn't maintain the connection (I tried with this script https://github.com/gfanton/libp2p-reuseport-test)

Just some few things:

  • It seems that there is no option/configuration mechanism, so I added one. Let me know if you are ok with this or if you want to use another method to pass the argument.
  • I wrapped all the conn_tests with a simple table test case to test everything conn related with the reuseport_on/off
  • I have to use net.ListenUDP instead of net.DialUDP for the Dial method to work, otherwise the call to the WriteTo method fails.

Also there are two tests that currently fail with the reuseport disabled:

TestHolePunching

=== RUN   TestHolePunching/reuseport_off
    conn_test.go:59: using a Secp256k1 key: 16Uiu2HAmPxEseg6Hti88hpHTyUB3tQk9bw7paj9yS3rPkBgPnWgM
    conn_test.go:59: using a Ed25519 key: 12D3KooWAaU8sc9j783H9hH3eG3yyJDnvz9Le1LdhCQFbYe5gFyu
    conn_test.go:581: 
        	Error Trace:	conn_test.go:581
        	           				asm_arm64.s:1133
        	Error:      	An error is expected but got nil.
        	Test:       	TestHolePunching/reuseport_off
        	Messages:   	didn't expect to accept any connections
    conn_test.go:602: 
        	Error Trace:	conn_test.go:602
        	Error:      	Condition never satisfied
        	Test:       	TestHolePunching/reuseport_off

TestStatelessReset

=== RUN   TestStatelessReset/reuseport_off
    conn_test.go:59: using a ECDSA key: QmRoF9AeMPnxYMrErq91y2xCvjiULp9n9cJuVwDHu9Kdao
    conn_test.go:59: using a RSA key: QmNvwzR7VDFy1wFdHE3PgV8mCztJbFWz1d5NXVL3wXYVgX
    conn_test.go:534: 
        	Error Trace:	conn_test.go:66
        	           				conn_test.go:534
        	Error:      	Received unexpected error:
        	           	listen udp4 127.0.0.1:55213: bind: address already in use
        	Test:       	TestStatelessReset/reuseport_off

Do these tests make sense when used with resuseport disabled?

@gfanton
Copy link
Contributor Author

gfanton commented May 4, 2022

didn't see libp2p/go-libp2p#1187, Im going to move this on go-lib2p repo

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

quic: make the reuseport feature optional
2 participants