Skip to content

Commit

Permalink
Merge pull request #2 from eface2face/master
Browse files Browse the repository at this point in the history
Swift: a better fix for cordova-rtc#161
  • Loading branch information
mark-veenstra committed Apr 15, 2016
2 parents 8b2c5a5 + f0a99b3 commit e49dca9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/iosrtcPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,19 @@ class iosrtcPlugin : CDVPlugin {
NSLog("iosrtcPlugin#RTCPeerConnection_close()")

let pcId = command.argumentAtIndex(0) as! Int
var pluginRTCPeerConnection = self.pluginRTCPeerConnections[pcId]
let pluginRTCPeerConnection = self.pluginRTCPeerConnections[pcId]

if pluginRTCPeerConnection == nil {
NSLog("iosrtcPlugin#RTCPeerConnection_close() | ERROR: pluginRTCPeerConnection with pcId=%@ does not exist", String(pcId))
return;
}

dispatch_async(self.queue) {
dispatch_async(self.queue) { [weak pluginRTCPeerConnection, unowned self] in
pluginRTCPeerConnection!.close()
pluginRTCPeerConnection = nil
}

// Remove the pluginRTCPeerConnection from the dictionary.
self.pluginRTCPeerConnections[pcId] = nil
// Remove the pluginRTCPeerConnection from the dictionary.
self.pluginRTCPeerConnections[pcId] = nil
}
}


Expand Down

0 comments on commit e49dca9

Please sign in to comment.