Skip to content

Commit 9da63b9

Browse files
committed
Isolate things that aren't nonisolated anymore
1 parent 89a78ab commit 9da63b9

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

Sources/allonet2/AlloClient.swift

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -265,35 +265,33 @@ open class AlloClient : AlloSessionDelegate, ObservableObject, Identifiable, Ent
265265
}
266266
}
267267

268-
nonisolated public func session(didDisconnect sess: AlloSession)
268+
public func session(didDisconnect sess: AlloSession)
269269
{
270-
Task { @MainActor in
271-
logger.info("Disconnected")
272-
avatarId = nil
273-
self.connectionStatus.signalling = .failed
274-
if(false)
275-
{
276-
// TODO: Propagate disconnection reason, and notice if it's permanent
277-
// state = .error ...
278-
}
279-
else if(self.connectionLoopCancellable != nil)
280-
{
281-
self.connectionStatus.reconnection = .waitingForReconnect
282-
}
283-
else
284-
{
285-
self.connectionStatus.reconnection = .idle
286-
}
270+
logger.info("Disconnected")
271+
avatarId = nil
272+
self.connectionStatus.signalling = .failed
273+
if(false)
274+
{
275+
// TODO: Propagate disconnection reason, and notice if it's permanent
276+
// state = .error ...
277+
}
278+
else if(self.connectionLoopCancellable != nil)
279+
{
280+
self.connectionStatus.reconnection = .waitingForReconnect
281+
}
282+
else
283+
{
284+
self.connectionStatus.reconnection = .idle
287285
}
288286
}
289287

290-
nonisolated public func session(_: AlloSession, didReceiveMediaStream: MediaStream)
288+
public func session(_: AlloSession, didReceiveMediaStream: MediaStream)
291289
{
292290
// Playback is handled in SpatialAudioPlayer
293291
// TODO: If I expose incomingTracks through Combine, why even have this callback?
294292
}
295293

296-
nonisolated public func session(_: AlloSession, didRemoveMediaStream: MediaStream)
294+
public func session(_: AlloSession, didRemoveMediaStream: MediaStream)
297295
{}
298296

299297
// MARK: - Interactions, intent and place state
@@ -320,7 +318,7 @@ open class AlloClient : AlloSessionDelegate, ObservableObject, Identifiable, Ent
320318
/// Use this to register handlers for all other kinds of Interactions.
321319
public var handlers = InteractionHandler<Void>()
322320

323-
nonisolated public func session(_: AlloSession, didReceiveInteraction inter: Interaction)
321+
public func session(_: AlloSession, didReceiveInteraction inter: Interaction)
324322
{
325323
Task { @MainActor in
326324
do
@@ -357,19 +355,16 @@ open class AlloClient : AlloSessionDelegate, ObservableObject, Identifiable, Ent
357355
}
358356
}
359357

360-
nonisolated public func session(_: AlloSession, didReceivePlaceChangeSet changeset: PlaceChangeSet)
358+
public func session(_: AlloSession, didReceivePlaceChangeSet changeset: PlaceChangeSet)
361359
{
362360
//logger.trace("Received place change for revision \(changeset.fromRevision) -> \(changeset.toRevision)")
363-
Task
364-
{ @MainActor in
365-
guard placeState.applyChangeSet(changeset) else
366-
{
367-
logger.warning("Failed to apply change set, asking for a full diff")
368-
currentIntent = Intent(ackStateRev: 0)
369-
return
370-
}
371-
currentIntent = Intent(ackStateRev: changeset.toRevision)
361+
guard placeState.applyChangeSet(changeset) else
362+
{
363+
logger.warning("Failed to apply change set, asking for a full diff")
364+
currentIntent = Intent(ackStateRev: 0)
365+
return
372366
}
367+
currentIntent = Intent(ackStateRev: changeset.toRevision)
373368
}
374369

375370
public func session(_: AlloSession, didReceiveIntent intent: Intent)

0 commit comments

Comments
 (0)