Skip to content

Commit fe1d39d

Browse files
committed
fix generating port for debug socket when debugging ios with chrome devtools
When generating a port to start a websocket on, use the same logic as is present in the android debug service - get the first available available port in a range, and reuse it for the next debug session of the same application if it is still available
1 parent 9eb3a22 commit fe1d39d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/device-sockets/ios/socket-proxy-factory.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class SocketProxyFactory extends EventEmitter implements ISocketProxyFact
7474

7575
public async createWebSocketProxy(factory: () => Promise<net.Socket>): Promise<ws.Server> {
7676
// NOTE: We will try to provide command line options to select ports, at least on the localhost.
77-
const localPort = await this.$net.getFreePort();
77+
const localPort = await this.$net.getAvailablePortInRange(41000);
7878

7979
this.$logger.info("\nSetting up debugger proxy...\nPress Ctrl + C to terminate, or disconnect.\n");
8080

test/services/ios-debug-service.ts

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ const createTestInjector = (): IInjector => {
4848
on: (event: string | symbol, listener: Function): any => undefined
4949
});
5050

51+
testInjector.register("net", {
52+
getAvailablePortInRange: async (startPort: number, endPort?: number): Promise<number> => 41000
53+
});
54+
5155
return testInjector;
5256
};
5357

0 commit comments

Comments
 (0)