BeginPortRange(49153) would be returned twice, causes duplication and potential errors.

If we first request port 49153 explicitly, and later some time request the next free port (of same ip and proto) by passing port number 0, we will again get 49153, the BeginPortRange, even if it's currently in use. Because findPort() blindly returned BeginPortRange the first run, without checking if it has already been taken.