n0-computer / iroh

peer-2-peer that just works
https://iroh.computer
Apache License 2.0
2.61k stars 165 forks source link

Iroh Connection cannot adjust TransportConfig for outgoing connections #2872

Open CGamesPlay opened 3 weeks ago

CGamesPlay commented 3 weeks ago

I was advised to create an issue from https://github.com/n0-computer/iroh/discussions/2860#discussioncomment-11100552. Iroh-net's Endpoint::connect is hard-coded to use a TransportConfig of every-second keepalives with 30-second timeouts (latter default from Quinn), regardless of any TransportConfig that was passed to Builder::transport_config (which is only used for incoming connections). This effectively means that you can only increase the keepalive interval and reduce the timeout from these defaults.

I can't think of a great reason that the incoming and outgoing TransportConfig values should ever be different, so I think the default should be to use the Endpoint's configured values for outgoing connections. However, if there is a use case for this (perhaps different ALPNs should have different timeouts), a method like connect_with(node_addr, alpn, transport_config) could work well.

flub commented 2 weeks ago

My proposal would be to: