Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicated connection working in an office #119

Open
chrisknapp98 opened this issue Nov 15, 2022 · 12 comments
Open

duplicated connection working in an office #119

chrisknapp98 opened this issue Nov 15, 2022 · 12 comments
Assignees
Labels
bug Something isn't working Done This Ticket is done

Comments

@chrisknapp98
Copy link

hi, me and my colleagues are experiencing duplicated connections from atlantis to Proxyman when we are working at the office. Thus, we receive the same network request multiple times with the exact same time, duration etc.

I couldn't find the root of the issue, but filtering in NetServiceTransport#connectToService(_ service: NetService) also gets the job done. Maybe it could be a change to be considered for a future release. Let's see if I manage to create a PR

A problem could be that with that change devices which have the same name couldn't connect both over the network to atlantis

@NghiaTranUIT
Copy link
Member

Do you specify the Computer Name when starting the Atlantis Service?

By doing it, Atlantis only connects to this computer, not your colleague's computers.

You can find a name in the Atlantis Windows.

Screenshot_2022-11-15_at_16_39_46

@NghiaTranUIT
Copy link
Member

and what Atlantis library version you're using 🤔 ?

@chrisknapp98
Copy link
Author

version 1.19.0

@chrisknapp98
Copy link
Author

The issue is not that it connects to my colleagues computers. No matter if I specify the device in start call, atlantis still keeps connecting multiple times to my Proxyman client. Sometimes it doesn't but often the conection is there like 5 times

@chrisknapp98
Copy link
Author

chrisknapp98 commented Nov 15, 2022

Okay I haven't got any permissions to push a new branch. But my fix is in line 226 after the guard let hostName to add

        guard !connections.contains(where: { connection in
            if case let NWEndpoint.service(name: connectedHostName, type: _, domain: _, interface: _) = connection.endpoint {
                let splittedHostName = hostName.split(separator: ".")
                let deviceName = splittedHostName.indices.contains(0) ? splittedHostName[0].lowercased() : "DEVICE_NAME"
                if connectedHostName.contains(deviceName) {
                    print("[Atlantis] Found duplicated endpoint")
                }
                return connectedHostName.contains(deviceName)
            }
            return false
        }) else {
            print("[Atlantis] Aborting new connection")
            return
        }

@chrisknapp98
Copy link
Author

ohh I'm just noticing that splitting at a dot and taking index 0 only works with our devices because the host name of our devices always is the serial number with the .local suffix

@NghiaTranUIT
Copy link
Member

If you don't mind, please add a checkpoint to this line

print("[Atlantis] ✅ Connect to \(hostName)")

and see how many print output.

If it connect to the same Macbook multiple times, we can see multiple outputs.

@chrisknapp98
Copy link
Author

exactly! That's how I knew atlantis connected to the same device multiple times. Without the guard block I added, this print with the exact same hostName can be seen multiple times.
I think this also especially happens when there are like 3+ colleagues in the office which are running Proxyman on their mac

@NghiaTranUIT
Copy link
Member

NghiaTranUIT commented Nov 15, 2022

@chrisknapp98 can you try this branch #120?

I refactor a little bit and prevent connecting multiple times to a single Host. I suppose that it can fix the bug.

How to install

Cocoapod

pod 'atlantis-proxyman', :git => 'https://github.com/ProxymanApp/atlantis.git', :commit => '7ee8312b13a6b872a0068bdf11bfc66511614c9f'

SPM

  • Checkout this commit: 7ee8312b13a6b872a0068bdf11bfc66511614c9f

@chrisknapp98
Copy link
Author

seems to be working 👍
I censored the names because it would be the serial numbers

[Atlantis] Looking for Proxyman app in the network...
[Atlantis] 🔎 Found Proxyman at HostName = DEVICE_1.local.
[Atlantis] 🔎 Found Proxyman at HostName = DEVICE_2.local.
[Atlantis] 🔎 Found Proxyman at HostName = DEVICE_3.local.
[Atlantis] ✅ Connect to DEVICE_1.local.
[Atlantis] 🔎 Found Proxyman at HostName = DEVICE_4.local.
[Atlantis] ✅ Connect to DEVICE_2.local.
[Atlantis] ✅ Connect to DEVICE_3.local.
[Atlantis] ✅ Connect to DEVICE_4.local.
[Atlantis] 🔎 Found Proxyman at HostName = DEVICE_1.local.
[Atlantis] ⚠️ Avoid connecting to DEVICE_1.local. because it's already connected!
[Atlantis] Connection established
[Atlantis] Connection established
[Atlantis] Connection established
[Atlantis] Connection established
[Atlantis] 🔎 Found Proxyman at HostName = DEVICE_1.local.
[Atlantis] ⚠️ Avoid connecting to DEVICE_1.local. because it's already connected!

@NghiaTranUIT
Copy link
Member

Thanks. Please play around with this update. If it's still working fine, I will release the fix this week 👍

@NghiaTranUIT
Copy link
Member

Just a friendly reminder that I've bumped new version 1.20.0, which contains the fix.

However, if you've encountered this bug #121 , Let's try the Proxyman beta build 👍

@NghiaTranUIT NghiaTranUIT added bug Something isn't working Done This Ticket is done labels Dec 15, 2022
@NghiaTranUIT NghiaTranUIT self-assigned this Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Done This Ticket is done
Projects
None yet
Development

No branches or pull requests

2 participants