Currently, sending a C2C message will synchronously attempt a direct connection with the peer before returning. This is fine if a direct connection is possible, but in many cases the client will have to wait the 10 seconds until the direct connection times out and it falls back to relay. Most C2C messages aren't bandwidth intensive, so it would be fine to relay them and attempt a direct connection in the background.
My proposal is to add a new option when opening a bidi on VirtualC2cConnection that will use an existing direct conn if any, otherwise use relay and kick off a direct connection attempt in the background. I would need to make sure that multiple concurrent attempts aren't made. This option could be used on most C2C calls like browsing folders, and NOT used on bandwidth-intensive messages like GetFile. This will allow users to instantly start browsing shares while a direct connection is attempted and hopefully active by the time they want to download a file.
I would also like to internally rank already-established direct connections based on ping latency and choose the connection with the lowest ping when making C2C calls.
Currently, sending a C2C message will synchronously attempt a direct connection with the peer before returning. This is fine if a direct connection is possible, but in many cases the client will have to wait the 10 seconds until the direct connection times out and it falls back to relay. Most C2C messages aren't bandwidth intensive, so it would be fine to relay them and attempt a direct connection in the background.
My proposal is to add a new option when opening a bidi on VirtualC2cConnection that will use an existing direct conn if any, otherwise use relay and kick off a direct connection attempt in the background. I would need to make sure that multiple concurrent attempts aren't made. This option could be used on most C2C calls like browsing folders, and NOT used on bandwidth-intensive messages like GetFile. This will allow users to instantly start browsing shares while a direct connection is attempted and hopefully active by the time they want to download a file.
I would also like to internally rank already-established direct connections based on ping latency and choose the connection with the lowest ping when making C2C calls.