Disallow BinatoStream from creating duplicate streams

This commit is contained in:
tgpethan 2020-09-02 11:34:10 +01:00
parent e9fd3993a8
commit 9d5790b2c7
2 changed files with 2 additions and 1 deletions

View file

@ -15,7 +15,6 @@ An implementation of osu!bancho in Javascript
## Bugs: ## Bugs:
- If a client clicks the plus button in the chat window to join another channel the client will "crash", the game will keep running but the user will be unable to do anything - If a client clicks the plus button in the chat window to join another channel the client will "crash", the game will keep running but the user will be unable to do anything
- BinatoStream can create duplicate streams
## How to connect: ## How to connect:

View file

@ -6,6 +6,8 @@ module.exports = class {
} }
addStream(streamName, removeIfEmpty, spectatorHostId = null) { addStream(streamName, removeIfEmpty, spectatorHostId = null) {
const streamNames = Object.keys(this.avaliableStreams);
if (streamNames.includes(streamName)) return global.consoleHelper.printBancho(`Did not add stream [${streamName}] A stream with the same name already exists`);
// Add new stream to the list of streams // Add new stream to the list of streams
this.avaliableStreams[streamName] = { this.avaliableStreams[streamName] = {
streamUsers: [], // An array containing a list of user IDs of the users in a given stream streamUsers: [], // An array containing a list of user IDs of the users in a given stream