Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.serverSocket = net.createServer(async (localSocket) => {
try {
const remoteSocket = await utilities.connectPort(this.udid, this.deviceport);
remoteSocket.on('close', () => localSocket.end());
remoteSocket.on('error', (e) => {
// not all remote socket errors are critical for the user
this.log.info(e.message);
this.log.debug(e);
});
localSocket.on('close', () => remoteSocket.end());
localSocket.on('error', (e) => this.log.warn(e.message));
localSocket.pipe(remoteSocket);
remoteSocket.pipe(localSocket);
} catch (e) {
this.log.error(e);
localSocket.end();
}
});
const status = new B((resolve, reject) => {
this.serverSocket = net.createServer(async (connection) => {
try {
const socket = await utilities.connectPort(this.udid, this.deviceport);
socket.on('close', connection.destroy);
socket.on('error', log.error);
connection.on('close', socket.destroy);
connection.on('error', log.error);
connection.pipe(socket);
socket.pipe(connection);
} catch (e) {
log.warn(e.message);
connection.destroy();
}
});
const status = new B((resolve, reject) => {