[Differential] [Request, 7 lines] D4788: Fix loosing network packets when LanLink socket is reset.

Giedrius Stanevičius noreply at phabricator.kde.org
Sat Feb 25 16:53:22 UTC 2017


giedrius created this revision.
giedrius added a project: KDE Connect.

REVISION SUMMARY
  There is a problem, that if many network packets are sent in short time and also at the same time LanLink socket happens to be reset (calling LanLink.reset method), some packets may get lost. It seems that when LanLink is being reset and old socket is being closed, some data on the wire can be discarded - the peer then thinks that the packets were sent successfully, but the host happens to think that socket is closed at it is all over. As I am not Java programmer, I didn't find a way to close the socket in a manner that all the data would be fully transmitted. Not sure if it is possible with SslSocket class at all.
  
  On the other hand, it seems that LankLink reset shouldn't be needed at all if we already have a functional socket. As far as I know, socket resets may happen in two cases, when a peer connects directly to a previously announced TCP port or when a host connects to a peer TCP port in response to broadcast UDP datagrams. In the former case, we definitely cant ignore the new socket, because the peer might have a good reason to create a new connection - maybe the socket on its side is broken or smth. However on the later case, if the host already has a working socket, there is no indication that it is broken, hence no need to create new sockets and risk loosing packets. Just that is done by my fix.

TEST PLAN
  The scenario may be simulated with such bash script on peer side:
  
  $ for i in $(seq 0 10); do echo $i > "tmp-$i.txt"; kdeconnect-cli --share "./tmp-$i.txt" --device 4b7309ec0a4ee3c1; done
  $ kdeconnect-cli --refresh

REPOSITORY
  R225 KDE Connect - Android application

REVISION DETAIL
  https://phabricator.kde.org/D4788

AFFECTED FILES
  src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: giedrius, #kde_connect
Cc: MayeulC, menasshock, apol, hkaelberer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20170225/7f0b0147/attachment.html>


More information about the KDEConnect mailing list