Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/common
2 changes: 1 addition & 1 deletion lib/device-sockets/ios/socket-proxy-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class SocketProxyFactory extends EventEmitter implements ISocketProxyFact
this.$logger.info("Frontend client connected.");
let _socket;
try {
_socket = await factory();
_socket = await helpers.connectEventuallyUntilTimeout(factory, 10000);
} catch (err) {
err.deviceIdentifier = deviceIdentifier;
this.$logger.trace(err);
Expand Down
21 changes: 15 additions & 6 deletions lib/services/ios-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,23 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
}

private getSocketFactory(device: Mobile.IiOSDevice, debugData: IDebugData, debugOptions: IDebugOptions): () => Promise<net.Socket> {
let pendingExecution: Promise<net.Socket> = null;
const factory = async () => {
const port = await this.$iOSDebuggerPortService.getPort({ projectDir: debugData.projectDir, deviceId: debugData.deviceIdentifier, appId: debugData.applicationIdentifier }, debugOptions);
if (!port) {
this.$errors.fail("NativeScript debugger was not able to get inspector socket port.");
if (!pendingExecution) {
const func = async () => {
const port = await this.$iOSDebuggerPortService.getPort({ projectDir: debugData.projectDir, deviceId: debugData.deviceIdentifier, appId: debugData.applicationIdentifier }, debugOptions);
if (!port) {
this.$errors.fail("NativeScript debugger was not able to get inspector socket port.");
}
const socket = device ? await device.connectToPort(port) : net.connect(port);
this._sockets.push(socket);
pendingExecution = null;
return socket;
};
pendingExecution = func();
}
const socket = device ? await device.connectToPort(port) : await this.$iOSEmulatorServices.connectToPort({ port });
this._sockets.push(socket);
return socket;

return pendingExecution;
};

factory.bind(this);
Expand Down