Skip to content

Commit 48ab6bd

Browse files
author
Ochii
committed
If the user tries to create a new room while in one on the server side, remove it from the old room and create the new one
1 parent 5e27b70 commit 48ab6bd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/channel/channelmanager.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,15 @@ export class ChannelManager {
190190
* @returns true if successful
191191
*/
192192
private onNewRoomRequest(newRoomReq: InRoomNewRequest, user: User): boolean {
193-
// don't allow the user to create a new room while in another one
193+
// if the user wants to create a new room, let it
194+
// this will remove the user from its current room
195+
// it should help mitigating the 'ghost room' issue,
196+
// where a room has users that aren't in it on the client's side
194197
if (user.currentRoom) {
195198
console.warn('user "%s" tried to create a new room, while in an existing one'
196199
+ 'current room: "%s" (id: %i)', user.userName, user.currentRoom.settings.roomName, user.currentRoom.id)
197200

198-
// tell the user to rejoin its own room
199-
// this tried to mitigate the 'ghost rooms' issue
200-
// (where the host's client left the room, but it's still in the room for the server)
201-
// TODO: find a better way to detect this
202-
user.currentRoom.sendJoinNewRoom(user)
201+
user.currentRoom.removeUser(user)
203202

204203
return false
205204
}

0 commit comments

Comments
 (0)