()
| 841 | } |
| 842 | |
| 843 | async function freePortPair(): Promise<number> { |
| 844 | for (let attempt = 0; attempt < 100; attempt += 1) { |
| 845 | const port = await freePort(); |
| 846 | if (port < 65535 && (await portAvailable(port + 1))) { |
| 847 | return port; |
| 848 | } |
| 849 | } |
| 850 | throw new Error("Unable to allocate adjacent free TCP ports."); |
| 851 | } |
| 852 | |
| 853 | function freePort(): Promise<number> { |
| 854 | return new Promise((resolve, reject) => { |
no test coverage detected