Skip to content

Commit

Permalink
devop: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kvhnuke committed Jan 12, 2022
1 parent 9417729 commit 3e46099
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
8 changes: 1 addition & 7 deletions src/connectClient/WebRtcCommunication.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class WebRtcCommunication extends MewConnectCommon {
this.answersReceived = [];
this.offersSent = -1;
this.turnTimer = null;
this.turnWaitTime = 5000;
this.turnWaitTime = 2000;
this.enableTimer = true;
this.tryingTurn = false;
this.connected = false;
Expand Down Expand Up @@ -162,7 +162,6 @@ export default class WebRtcCommunication extends MewConnectCommon {
onConnect(peerID) {
debug('onConnect', peerID);
this.connected = true;
// this.emit('connect', peerID);
this.emit(this.jsonDetails.lifeCycle.RtcConnectedEvent, peerID);
this.clearExtraOnConnection();
}
Expand Down Expand Up @@ -240,7 +239,6 @@ export default class WebRtcCommunication extends MewConnectCommon {
// Handle Socket Attempting Turn informative signal
// Provide Notice that initial WebRTC connection failed and the fallback method will be used
willAttemptTurn() {
this.uiCommunicator(this.lifeCycle.UsingFallback, this.activeInitiatorId);
if (!this.connected && this.tryingTurn && this.usingVersion === 'V2') {
this.refreshQrTimer();
this.refreshEnabled = false;
Expand All @@ -250,7 +248,6 @@ export default class WebRtcCommunication extends MewConnectCommon {
debugStages(' TRY TURN V2');
this.tryingTurn = true;
try {
console.log('here', 1);
this.useFallback();
} catch (e) {
// eslint-disable-next-line
Expand Down Expand Up @@ -279,7 +276,6 @@ export default class WebRtcCommunication extends MewConnectCommon {

useFallback() {
if (!this.connected) {
console.log('here', 4);
this.emit(this.lifeCycle.UsingFallback, this.activeInitiatorId);
}
}
Expand Down Expand Up @@ -311,7 +307,6 @@ export default class WebRtcCommunication extends MewConnectCommon {
!this.turnDisabled
) {
this.turnDisabled = true;
console.log('here', 2);
this.useFallback();
}
}
Expand Down Expand Up @@ -419,7 +414,6 @@ export default class WebRtcCommunication extends MewConnectCommon {
}

if (!this.connected && !this.tryingTurn && !this.turnDisabled) {
console.log('here', 3);
this.useFallback();
} else {
if (!this.isAlive()) {
Expand Down
8 changes: 0 additions & 8 deletions src/connectClient/initiator/MewConnectInitiatorV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,13 @@ export default class MewConnectInitiatorV2 extends MewConnectCommon {
} catch (e) {
debug('constructor error:', e);
}

this.webRtcCommunication.on(this.lifeCycle.UsingFallback, id => {
debug('USING TURN FALLBACK', id, this.initiatorId);
if (this.initiatorId === id) {
console.log('lifecycle fallback');
this.useFallback();
} else {
this.socketDisconnect();
this.isActiveInstance = false;
// this.webRtcCommunication.off('data', this.onData.bind(this, ''));
}
});
}
Expand Down Expand Up @@ -180,9 +177,7 @@ export default class MewConnectInitiatorV2 extends MewConnectCommon {
}

async useFallback() {
console.log('retry', this.retryCount);
this.retryCount++;

if (this.retryCount >= 4) {
this.emit('showRefresh');
return;
Expand Down Expand Up @@ -378,15 +373,13 @@ export default class MewConnectInitiatorV2 extends MewConnectCommon {
this.offersSent.push(data.sdp);
// App was waiting for turn data and not sending back an answer
this.offerTimer = setTimeout(() => {
console.log('offer timeout');
this.useFallback();
}, 5000);
debug('sendOffer', this.initiatorId);
try {
this.emit('sendingOffer');
debug('SIGNAL', JSON.stringify(data));
const encryptedSend = await this.mewCrypto.encrypt(JSON.stringify(data));
// this.uiCommunicator(this.lifeCycle.sendOffer);
this.states.offer = true;
this.socketEmit(this.signals.offerSignal, {
data: encryptedSend,
Expand Down Expand Up @@ -524,7 +517,6 @@ export default class MewConnectInitiatorV2 extends MewConnectCommon {
debug(err.code);
debug('error', err);
if (!this.connected && !this.tryingTurn && !this.turnDisabled) {
console.log('on error retyr');
this.useFallback();
} else if (!this.connected && this.tryingTurn && !this.turnDisabled) {
this.emit('ShowReload');
Expand Down

0 comments on commit 3e46099

Please sign in to comment.