szimek / sharedrop

Easy P2P file transfer powered by WebRTC - inspired by Apple AirDrop
https://www.sharedrop.io
MIT License
9.94k stars 725 forks source link

Allow retrying interrupted transfers. #114

Open rkjnsn opened 3 years ago

rkjnsn commented 3 years ago

A couple of my machines are behind a large NAT shared with a large number of other users. As such, there is sometimes contention for the limited number of external UDP ports. This can manifest in two different ways:

  1. Failure to connect. This can happen if a different port gets allocated for direct communication than for the STUN request due to port contention. This is pretty easy to work around since it will almost always work after a couple of attempts.
  2. Interrupted transfers. This can happen if the NAT runs out of ports and reclaims the one being used for the transfer. This is much more annoying, since it often happens a good chunk of the way through a large file.

For the latter, it would be nice if there were an option to attempt to resume a transfer (and retry multiple times if necessary to reestablish a connection) rather than starting over from the beginning. Currently, ShareDrop doesn't even seem to realize the connection has failed, even though WebRTC reports the connection as dead.