snapdrop icon indicating copy to clipboard operation
snapdrop copied to clipboard

My device is listed twice (sometimes)

Open brunetton opened this issue 2 years ago • 6 comments

Hi

I noticed that my device is listed twice, sometimes ... This appears quite random to me; I didn't found a reproductible way of making this happens.

Screenshot_20221031_132128_com android chrome_1

brunetton avatar Oct 31 '22 12:10 brunetton

I also see this. Does it happen when you toggle the device's network connection? (Turn off the wifi connection, when turn it on again)

mwy001 avatar Nov 03 '22 07:11 mwy001

I also see this. Does it happen when you toggle the device's network connection? (Turn off the wifi connection, when turn it on again)

No I didn't toggled the network connection at all

brunetton avatar Nov 03 '22 13:11 brunetton

An easy way to list device twice is to open Snapdrop in two different tabs (load the first, then the second).

I think this behavior can be easily modified here:

https://github.com/RobinLinus/snapdrop/blob/cc9c2bf088d5b2bb1316b35f8a420fa1e305fc2b/client/scripts/network.js#L30

https://github.com/RobinLinus/snapdrop/blob/cc9c2bf088d5b2bb1316b35f8a420fa1e305fc2b/client/scripts/network.js#L45

A problem could be, anyway, that display-name may be fired after all peers display, so there is no (really) simple way then to remove a peer already displayed.

Bellisario avatar Nov 04 '22 09:11 Bellisario

The "peers" message (notify peer about the other peers) returned from the WS server may include the calling/current peer. It should be excluded.

I have a possible fix for this:

https://github.com/RobinLinus/snapdrop/commit/f1a5b0dabcaa937ee53423aa38ace07eb32d5202

mwy001 avatar Nov 04 '22 11:11 mwy001

@mwy001 I think that's a very good fix! Is there any pull request for this? I don't see it on Snapdrop pulls.

P.S.: just to be perfect, I think comparation you made would be better strict (== to ===)

Bellisario avatar Nov 04 '22 14:11 Bellisario

@Bellisario Thanks for the comments. Pull request created: https://github.com/RobinLinus/snapdrop/pull/528

mwy001 avatar Nov 04 '22 17:11 mwy001