Skip to content

Commit

Permalink
outbound net system cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Martin committed Jul 6, 2023
1 parent 91185f8 commit cb05a70
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/engine/network/OutboundNetworkSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ const sendUpdatesHost = (ctx: GameContext, network: GameNetworkState) => {

let peerId;
while ((peerId = newPeersQueue.dequeue())) {
const peerIndex = getPeerIndex(network, peerId);
if (!peerIndex) {
throw new Error("Peer index missing for peerId: " + peerId);
}
const peerIndex = tryGetPeerIndex(network, peerId);

// inform new peer(s) and all other peers of new avatar(s)
// TODO: this is redundant for peers other than this new peer
Expand Down Expand Up @@ -87,7 +84,7 @@ const sendUpdatesClient = (ctx: GameContext, network: GameNetworkState) => {
return;
}

const connectedToHost = isHost(network) || (network.hostId && network.peers.includes(network.hostId));
const connectedToHost = network.hostId && network.peers.includes(network.hostId);
if (!connectedToHost) {
return;
}
Expand Down

0 comments on commit cb05a70

Please sign in to comment.