Skip to content

Conversation

@atosatto
Copy link
Contributor

Trying to fix issue #56 during the Torino HackNight contest.

The idea is basically to select a pair of free port from port-range using the net.Listen function.
The two ports are later used by gin to listen for incoming HTTP or HTTPS connections.

Signed-off-by: Andrea Tosatto <andrea.tosy@gmail.com>
main.go Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can maybe add a comment here to explain why you're passing portPlain+1. I heard people confused by it in the office. But of course if you find a free port, the previous are all occupied, and there's no reason to cycle through them again.

@matteosuppo matteosuppo self-assigned this Jan 22, 2016
@matteosuppo
Copy link
Contributor

I tested it with different listening services on different ports and it works. Just add that comment and we can merge it.

…e PR#58

Signed-off-by: Andrea Tosatto <andrea.tosy@gmail.com>
@atosatto
Copy link
Contributor Author

I've added a comment as you suggested. Maybe it's a little bit verbose, but it should clarify why I'm passing portPlain+1.

Signed-off-by: Andrea Tosatto <andrea.tosy@gmail.com>
matteosuppo added a commit that referenced this pull request Jan 23, 2016
@matteosuppo matteosuppo merged commit d9eca8e into arduino:devel Jan 23, 2016
@matteosuppo
Copy link
Contributor

Thank you very much

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