Skip to content

Commit 3401a9b

Browse files
Merge pull request #881 from preactjs/cleanup-net-utils
2 parents b80f150 + f3e7006 commit 3401a9b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/wmr/src/lib/net-utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ export async function isPortFree(port) {
3030
* @returns {Promise<number>} The next free port
3131
*/
3232
export async function getFreePort(port) {
33-
let found = false;
3433
let attempts = 0;
3534

3635
if (typeof port === 'string') port = parseInt(port, 10);
3736

3837
// Limit to 20 attempts for now
39-
while (!found && attempts <= 20) {
40-
if (isPortFree(port)) break;
38+
while (attempts <= 20) {
39+
if (await isPortFree(port)) break;
4140

4241
port++;
4342
attempts++;

0 commit comments

Comments
 (0)