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

Sort openPorts and failedPorts before returning #146

Merged
merged 1 commit into from
May 28, 2024
Merged

Conversation

n0a
Copy link
Contributor

@n0a n0a commented May 28, 2024

This commit addresses an issue where the order of ports in the scan results (openPorts and failedPorts) appeared random due to the asynchronous nature of the port checking process.

Problem:
The port scanning process involves checking multiple ports asynchronously. As a result, ports are added to the openPorts and failedPorts arrays in the order in which the checks complete, rather than in numerical order. This leads to an unpredictable and unsorted list of ports in the final results.

Solution:
To ensure consistency and readability, the arrays openPorts and failedPorts are now explicitly sorted in ascending numerical order before being returned. This sorting is done after all port checks are complete, ensuring that the final output is always in a predictable, ordered format.

Changes:

  • Added sorting of openPorts and failedPorts arrays before returning the results.
  • Ensured that ports not checked due to a timeout are also added to the failedPorts array in a sorted manner.

These changes improve the readability and usability of the scan results, making it easier for users to interpret the output.

Copy link

netlify bot commented May 28, 2024

Deploy Preview for web-check ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b55a1cc
🔍 Latest deploy log https://app.netlify.com/sites/web-check/deploys/66551f51b942620008047efb
😎 Deploy Preview https://deploy-preview-146--web-check.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Lissy93 Lissy93 merged commit 5b71ba9 into Lissy93:master May 28, 2024
4 of 5 checks passed
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.

2 participants