markvincze / Stubbery

Library for creating Api stubs in .NET. https://markvincze.github.io/Stubbery/
MIT License
74 stars 14 forks source link

Fix port collision problem #32

Closed jbroumels closed 3 years ago

jbroumels commented 3 years ago

use port 0 when no portnumber is specified. Then there's no chance of port collision when ApiStub instances are created / started in parallel. The time between "FindFreePort" and "Start" can cause the same port number to be returned from "FindFreePort"

markvincze commented 3 years ago

Thanks for the PR!

I didn't know it was possible to pass in 0 and then the framework takes care of it, this is really nice. I'll pull your branch, will clean it up, and open a new PR from it.

markvincze commented 3 years ago

@jbroumels I pushed your branch to my remote, removed the unused code and opened a PR with it: https://github.com/markvincze/Stubbery/pull/33, if it's okay, I'll merge that one and close this.

(I still didn't figure out if there is a better way to collaborate if the PR comes from a fork.)