File tree Expand file tree Collapse file tree 3 files changed +438
-3
lines changed
Sources/SwiftOCA/OCA/Browsing Expand file tree Collapse file tree 3 files changed +438
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ private let connectionOptions = Ocp1ConnectionOptions(flags: [
2626@main
2727public enum BrokerTest {
2828 public static func main( ) async throws {
29- #if canImport(Darwin)
29+ #if canImport(Darwin) || canImport(dnssd)
3030 let broker = await OcaConnectionBroker ( connectionOptions: connectionOptions)
3131 print ( " waiting for events from broker... " )
3232 for try await event in await broker. events {
@@ -40,7 +40,7 @@ public enum BrokerTest {
4040 }
4141 print ( " done! " )
4242 #else
43- preconditionFailure ( " OcaConnectionBroker not yet supported on non-Darwin platforms " )
43+ preconditionFailure ( " OcaConnectionBroker not available on this platform " )
4444 #endif
4545 }
4646}
Original file line number Diff line number Diff line change 1414// limitations under the License.
1515//
1616
17- #if canImport(Darwin)
17+ #if canImport(Darwin) || canImport(dnssd)
1818
1919import AsyncAlgorithms
2020import AsyncExtensions
@@ -224,7 +224,11 @@ public actor OcaConnectionBroker {
224224 var browserMonitor : Task < ( ) , Error > ?
225225
226226 init ( serviceType: OcaNetworkAdvertisingServiceType , broker: OcaConnectionBroker ) throws {
227+ #if canImport(dnssd)
228+ browser = try OcaDNSServiceBrowser ( serviceType: serviceType)
229+ #else
227230 browser = try OcaNetServiceBrowser ( serviceType: serviceType)
231+ #endif
228232 Task { try await browser. start ( ) }
229233 browserMonitor = Task { [ weak broker] in
230234 for try await result in browser. browseResults {
You can’t perform that action at this time.
0 commit comments