Skip to content

Add Network transport adapters - #27

Closed
rchatham wants to merge 2 commits into
feature/network-migration-async-observersfrom
feature/network-migration-transport-adapters
Closed

Add Network transport adapters#27
rchatham wants to merge 2 commits into
feature/network-migration-async-observersfrom
feature/network-migration-transport-adapters

Conversation

@rchatham

Copy link
Copy Markdown
Owner

Summary

Adds the next stacked Network migration slice: internal Network transport adapters that make the existing NetworkPeerCoordinator reachable through the transport factory seam, while keeping MultipeerConnectivity as the only public/default backend.

Changes

  • Split MC-specific session requirements into MultipeerSessionTransport.
  • Keep PeerSession conforming to the MC-specific transport protocol.
  • Update MC-only consumers (PeerBrowser, advertiser assistant, invitation handler bridge) to require MultipeerSessionTransport.
  • Add internal PeerConnectionTransportFactory.networkFramework.
  • Add internal Network transport adapters:
    • NetworkPeerSessionTransport
    • NetworkPeerBrowserTransport
    • NetworkPeerAdvertiserTransport
    • NetworkPeerAdvertiserAssisstantTransport
  • Add NetworkPeerListening / NetworkPeerBrowsing test seams.
  • Allow Network connections/browsers to set handlers after construction so adapters can wire coordinator callbacks.
  • Keep stream/resource transfer unsupported for Network with explicit internal errors instead of crashes.

Non-goals

  • No public backend selector yet.
  • No default backend change.
  • No SwiftUI/browser UI changes.
  • No local simulator loopback integration yet.
  • Discovery still uses endpoint-derived temporary identities; PR Add Network transport adapters #27 will add Bonjour identity metadata.

Verification

  • swift test — 84 tests passed
  • xcodebuild test -project PeerConnectivity.xcodeproj -scheme PeerConnectivity -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' -configuration Debug — 84 tests passed

Stack context

Stacked on PR #25 (feature/network-migration-async-observers). This is intended to become PR #26 in the Network migration stack.

…observers' into HEAD

# Conflicts:
#	PeerConnectivity.xcodeproj/project.pbxproj
#	Sources/PeerAdvertiserAssisstant.swift
#	Sources/PeerConnectionManager.swift
#	Sources/PeerConnectionTransports.swift

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds internal Network.framework transport adapters and introduces a Multipeer-specific transport protocol split so MultipeerConnectivity-only components can depend on MC capabilities while keeping the default/public backend unchanged.

Changes:

  • Split PeerSessionTransport into generic PeerSessionTransport + MC-specific MultipeerSessionTransport, and updated MC-only consumers accordingly.
  • Added internal Network.framework adapter transports and a PeerConnectionTransportFactory.networkFramework factory for wiring them.
  • Added Network transport adapter unit tests and updated the Xcode project to include the new sources/tests.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Sources/PeerSession.swift Updates PeerSession to conform to the new MC-specific transport protocol.
Sources/PeerConnectionTransports.swift Introduces MultipeerSessionTransport and adds the internal Network factory wiring.
Sources/PeerConnectionManager.swift Gates multipeerSession access behind MultipeerSessionTransport and updates invitation handling signature.
Sources/PeerBrowser.swift Requires MultipeerSessionTransport for MC browser construction.
Sources/PeerAdvertiserEventProducer.swift Updates invitation handler to require MultipeerSessionTransport so it can access MCSession.
Sources/PeerAdvertiserAssisstant.swift Requires MultipeerSessionTransport for MC advertiser assistant.
Sources/NetworkPeerTransportAdapters.swift Adds Network.framework transport adapter implementations (session/browser/advertiser/assistant).
Sources/NetworkPeerTransport.swift Adds Network browsing/listening seams and enables post-construction handler wiring.
PeerConnectivityTests/NetworkPeerTransportAdapterTests.swift Adds coverage for Network adapter factory construction and basic adapter behaviors.
PeerConnectivity.xcodeproj/project.pbxproj Registers new Network adapter source/test files in the Xcode project.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Sources/PeerConnectionManager.swift
Comment thread Sources/NetworkPeerTransport.swift
Comment thread Sources/NetworkPeerTransportAdapters.swift
@rchatham

Copy link
Copy Markdown
Owner Author

Superseded by consolidated PR #29. No commits were discarded; this branch is preserved as a recovery and reference point. Addressed review findings were replied to and resolved before consolidation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants