small fix

This commit is contained in:
pietru 2024-08-24 17:18:01 +02:00
parent 2098118844
commit 05124b7be3
2 changed files with 5 additions and 5 deletions

View file

@ -86,12 +86,12 @@ class Peer {
}
class Lobby {
constructor(name, host, mesh, single_host, public) {
constructor(name, host, mesh, single_host, is_public) {
this.name = name;
this.host = host;
this.mesh = mesh;
this.single_host = single_host;
this.public = public;
this.is_public = is_public;
this.peers = [];
this.sealed = false;
this.closeTimer = -1;
@ -160,7 +160,7 @@ class Lobby {
const lobbies = new Map();
let peersCount = 0;
function joinLobby(peer, pLobby, mesh, single_host, public) {
function joinLobby(peer, pLobby, mesh, single_host, is_public) {
let lobbyName = pLobby;
if (lobbyName === '') {
if (lobbies.size >= MAX_LOBBIES) {
@ -171,7 +171,7 @@ function joinLobby(peer, pLobby, mesh, single_host, public) {
throw new ProtoError(4000, STR_ALREADY_IN_LOBBY);
}
lobbyName = randomSecret();
lobbies.set(lobbyName, new Lobby(lobbyName, peer.id, mesh, single_host, public));
lobbies.set(lobbyName, new Lobby(lobbyName, peer.id, mesh, single_host, is_public));
console.log(`Peer ${peer.id} created lobby ${lobbyName}`);
console.log(`Open lobbies: ${lobbies.size}`);
}
@ -229,7 +229,7 @@ function parseMsg(peer, msg) {
if (type === CMD.GET_PUBLIC) {
let pb = []
for (lb in lobbies.keys()){
if (lobbies[lb].public){
if (lobbies[lb].is_public){
pb.append(lb)
}
}