Skip to content

Commit

Permalink
fix: var name
Browse files Browse the repository at this point in the history
  • Loading branch information
arn4b committed Sep 15, 2023
1 parent 61c6bfe commit a4ba132
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/restapi/src/lib/spaceV2/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export async function connect(
peerConnection?.on('error', (err: any) => {
console.log('error in connect', err);

const incomingIndex = peerAddress
const pendingIndex = peerAddress
? getIncomingIndexFromAddress(this.data.pendingPeerStreams, peerAddress)
: 0;

if (this.data.pendingPeerStreams[incomingIndex].retryCount >= 5) {
if (this.data.pendingPeerStreams[pendingIndex].retryCount >= 5) {
console.log('Max retries exceeded, please try again.');
this.disconnect({
peerAddress: peerAddress
Expand All @@ -47,7 +47,7 @@ export async function connect(
// retrying in case of connection error
this.request({
senderAddress: this.data.local.address,
recipientAddress: this.data.pendingPeerStreams[incomingIndex].address,
recipientAddress: this.data.pendingPeerStreams[pendingIndex].address,
chatId: this.data.spaceInfo.spaceId,
retry: true,
});
Expand All @@ -58,10 +58,10 @@ export async function connect(
// update space data
this.setSpaceV2Data((oldSpaceData) => {
return produce(oldSpaceData, (draft) => {
const incomingIndex = peerAddress
const pendingIndex = peerAddress
? getIncomingIndexFromAddress(oldSpaceData.pendingPeerStreams, peerAddress)
: 0;
draft.pendingPeerStreams[incomingIndex].status = VideoCallStatus.CONNECTED;
draft.pendingPeerStreams[pendingIndex].status = VideoCallStatus.CONNECTED;
});
});
} catch (err) {
Expand Down

0 comments on commit a4ba132

Please sign in to comment.