Skip to content

Commit efeb634

Browse files
committed
Merge branch 'master' of github.com:insidegui/MultipeerKit
2 parents 9d2929c + 3c92837 commit efeb634

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

Sources/MultipeerKit/Internal API/MultipeerConnection.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ extension MultipeerConnection: MCNearbyServiceBrowserDelegate {
176176
case .automatic:
177177
browser.invitePeer(peerID, to: session, withContext: nil, timeout: 10.0)
178178
case .custom(let inviter):
179-
guard let invite = inviter(peer) else {
179+
guard let invite = try inviter(peer) else {
180180
os_log("Custom invite not sent for peer %@", log: self.log, type: .error, String(describing: peer))
181181
return
182182
}
@@ -217,7 +217,9 @@ extension MultipeerConnection: MCNearbyServiceAdvertiserDelegate {
217217

218218
guard let peer = discoveredPeers[peerID] else { return }
219219

220-
configuration.security.invitationHandler(peer, context, { decision in
220+
configuration.security.invitationHandler(peer, context, { [weak self] decision in
221+
guard let self = self else { return }
222+
221223
invitationHandler(decision, decision ? self.session : nil)
222224
})
223225
}

Sources/MultipeerKit/Public API/MultipeerConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public struct MultipeerConfiguration {
1212
case automatic
1313
/// Use `.custom` when you want to control the invitation of new peers to your session,
1414
/// but still invite them at the time of discovery.
15-
case custom((Peer) -> (context: Data, timeout: TimeInterval)?)
15+
case custom((Peer) throws -> (context: Data, timeout: TimeInterval)?)
1616
/// Use `.none` when you want to manually invite peers by calling `invite` in `MultipeerTransceiver`.
1717
case none
1818
}

0 commit comments

Comments
 (0)