google / nearby

🐿️ A collection of projects focused on connectivity that enable building cross-device experiences.
https://developers.google.com/nearby
Apache License 2.0
754 stars 155 forks source link

ConnectionManager is unable to distinguish the same device when discovered multiple times #1877

Open jmg-duarte opened 1 year ago

jmg-duarte commented 1 year ago

Project

Nearby Connections Examples

Language

Swift

OS Platform

Apple

What happened?

I'm using the iOS example applications, completely out of the box, on the following devices:

And the following happens:

https://github.com/google/nearby/assets/15343819/11754b1a-1b26-44e8-a87c-8906a2b02d5d

This is not app related, as I've ran into this issue on an app I'm developing before testing with the example. It's also not strategy related as I'm running Point-to-Point on my app and Cluster on the example.

What did you expect to happen?

The device list should not have duplicates.

How can we reproduce it (as minimally and precisely as possible)?

  1. Start advertising on device 1
  2. Start discovery on device 2
  3. Toggle discovery between on and off several times
  4. See the list grow

How often does this bug happen?

Every time

Standalone code to reproduce the issue

NA

Relevant log output

NA

Anything else we need to know?

NA

jmg-duarte commented 1 year ago

I just noticed that the issue lies in the usage of an Array rather than an Map, not sure if you will want to improve the example or keep it as it is so for now I'm leaving the issue open

bourdakos1 commented 1 year ago

You’re welcome to submit a pull request if you have a fix, otherwise I can take a look :)