Skip to content

Commit 4849ba5

Browse files
authored
Merge pull request #57 from CoreyCole/patch-1
fix(signaling): save reference to peer connection before removing it
2 parents ea5b122 + 0653961 commit 4849ba5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/src/call_sample/signaling.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,16 @@ class Signaling {
201201
case 'leave':
202202
{
203203
var id = data;
204-
_peerConnections.remove(id);
204+
var pc = _peerConnections.remove(id);
205205
_dataChannels.remove(id);
206206

207207
if (_localStream != null) {
208208
_localStream.dispose();
209209
_localStream = null;
210210
}
211211

212-
var pc = _peerConnections[id];
213212
if (pc != null) {
214213
pc.close();
215-
_peerConnections.remove(id);
216214
}
217215
this._sessionId = null;
218216
if (this.onStateChange != null) {

0 commit comments

Comments
 (0)