mirror of https://github.com/embarklabs/embark.git
fix(@embark/proxy): fix conflict for WS port in the proxy
This error arose when using tests parallel to Embark
This commit is contained in:
parent
db0e45e96e
commit
eae97dee4f
|
@ -8,7 +8,7 @@ export function findNextPort(port: number) {
|
|||
return new Promise<number>((resolve) => {
|
||||
server.once("close", () => resolve(port));
|
||||
server.on("error", () => resolve(findNextPort(port + 1)));
|
||||
server.listen(port, () => server.close());
|
||||
server.listen(port, 'localhost', () => server.close());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -93,9 +93,10 @@ export default class ProxyManager {
|
|||
this.inited = true;
|
||||
|
||||
// setup ports
|
||||
const port = await findNextPort(this.embark.config.blockchainConfig.rpcPort + constants.blockchain.servicePortOnProxy);
|
||||
this.rpcPort = port;
|
||||
this.wsPort = port + 1;
|
||||
const rpcPort = await findNextPort(this.embark.config.blockchainConfig.rpcPort + constants.blockchain.servicePortOnProxy);
|
||||
const wsPort = await findNextPort(this.embark.config.blockchainConfig.wsPort + constants.blockchain.servicePortOnProxy);
|
||||
this.rpcPort = rpcPort;
|
||||
this.wsPort = wsPort;
|
||||
|
||||
// setup proxy details
|
||||
this.isVm = this.embark.config.blockchainConfig.client === constants.blockchain.vm;
|
||||
|
|
Loading…
Reference in New Issue