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

Fix and improve the sendOtp for loop #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Berna-L
Copy link

@Berna-L Berna-L commented Apr 8, 2023

Currently, the sendOtp loop is using the ips string's length to loop, which is wrong.

I took the opportunity and changed up the code so it's cleaner (I think?) and doesn't hang if one of the hosts isn't reachable (which will be 99% of the time if the user configured more than one IP address): now, the app will shoot the OTP code to all configured clients and use the first reply received as the condition to autoclose or not.

Since any client that's actually waiting for the code will be quick to reply (while the other clients won't be running at all), this will make it feel like the current (mono-IP) version in which the app quickly opens and closes. If the user opened the app without any client running, it'll timeout all requests in five seconds and not autoclose.

@Berna-L Berna-L changed the title Fix what length is used in the sendOtp for loop Fix the sendOtp for loop Apr 8, 2023
Now, it'll basically shoot the OTP at the same time to all registered IPs. Since any IP that actually has XL waiting for the code will reply quickly, it'll return true if any client received the code.

If no client is running, any fail response is good.
@Berna-L Berna-L changed the title Fix the sendOtp for loop Fix and improve the sendOtp for loop Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant