Fix port collision caused by race condition in tests (#164)
* Fix port collision caused by race condition in tests The ipv6 port is not randomized, if the previous ports for the last test didn't get freed in time, the server can crash on launch * try again * Update index.d.ts * Update genPacketDumps.js
This commit is contained in:
parent
e3e553bf91
commit
bb2179a8cb
2 changed files with 5 additions and 3 deletions
2
index.d.ts
vendored
2
index.d.ts
vendored
|
|
@ -24,6 +24,8 @@ declare module "bedrock-protocol" {
|
|||
}
|
||||
|
||||
export interface ClientOptions extends Options {
|
||||
// The username to connect to the server as
|
||||
username: string,
|
||||
// The view distance in chunks
|
||||
viewDistance?: number,
|
||||
// Specifies which game edition to sign in as. Optional, but some servers verify this.
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ function hasDumps (version) {
|
|||
let loop
|
||||
|
||||
async function dump (version, force = true) {
|
||||
const random = ((Math.random() * 100) | 0)
|
||||
const port = 19130 + random
|
||||
const random = (Math.random() * 1000) | 0
|
||||
const [port, v6] = [19132 + random, 19133 + random]
|
||||
|
||||
console.log('Starting dump server', version)
|
||||
const handle = await vanillaServer.startServerAndWait(version || CURRENT_VERSION, 1000 * 120, { 'server-port': port })
|
||||
const handle = await vanillaServer.startServerAndWait(version || CURRENT_VERSION, 1000 * 120, { 'server-port': port, 'server-portv6': v6 })
|
||||
|
||||
console.log('Started dump server', version)
|
||||
const client = new Client({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue