Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: registerRTT would break successful queries #610

Merged
merged 5 commits into from
Aug 19, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
revert "revert commit"
CosminPerRam committed Aug 19, 2024
commit 1dd78cd1bf46756781958f7aa901d290af3a6c41
15 changes: 5 additions & 10 deletions protocols/minecraft.js
Original file line number Diff line number Diff line change
@@ -24,28 +24,23 @@ export default class minecraft extends Core {
const vanillaResolver = new minecraftvanilla()
vanillaResolver.options = this.options
vanillaResolver.udpSocket = this.udpSocket
promises.push((async () => {
try { return await vanillaResolver.runOnceSafe() } catch (e) {}
})())
promises.push(vanillaResolver)

const gamespyResolver = new Gamespy3()
gamespyResolver.options = {
...this.options,
encoding: 'utf8'
}
gamespyResolver.udpSocket = this.udpSocket
promises.push((async () => {
try { return await gamespyResolver.runOnceSafe() } catch (e) {}
})())
promises.push(gamespyResolver)

const bedrockResolver = new minecraftbedrock()
bedrockResolver.options = this.options
bedrockResolver.udpSocket = this.udpSocket
promises.push((async () => {
try { return await bedrockResolver.runOnceSafe() } catch (e) {}
})())
promises.push(bedrockResolver)

const [vanillaState, gamespyState, bedrockState] = await Promise.all(promises)
const ranPromises = promises.map(p => p.runOnceSafe().catch(_ => undefined))
const [vanillaState, gamespyState, bedrockState] = await Promise.all(ranPromises)

state.raw.vanilla = vanillaState
state.raw.gamespy = gamespyState