public override int GetNextFreePort(string trace) { int port = _portRepository.reserveNextPort(trace); while (_portProbe.isOccupied(port)) { port = _portRepository.reserveNextPort(trace); } return(port); }
public override int GetNextFreePort(string ignored) { lock (this) { while (_currentPort <= EphemeralPortMaximum) { if (!_portProbe.isOccupied(_currentPort)) { return(_currentPort++); } _currentPort++; } throw new System.InvalidOperationException("There are no more ports available"); } }