Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
//

import Foundation
import FlyingSocks

package struct AsyncBufferedFileSequence: AsyncBufferedSequence {
package typealias Element = UInt8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
// SOFTWARE.
//

@testable import FlyingFox
@testable import FlyingSocks
import Foundation
import Testing
Expand Down Expand Up @@ -113,7 +114,7 @@ struct AsyncBufferedFileSequenceTests {

private extension URL {
static var jackOfHeartsRecital: URL {
Bundle.module.url(forResource: "Resources", withExtension: nil)!
Bundle.module.url(forResource: "Stubs", withExtension: nil)!
.appendingPathComponent("JackOfHeartsRecital.txt")
}
}
Expand Down
4 changes: 4 additions & 0 deletions FlyingSocks/Sources/AsyncBufferedCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
// SOFTWARE.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

package struct AsyncBufferedCollection<C: Collection>: AsyncBufferedSequence where C: Sendable, C.Element: Sendable {
package typealias Element = C.Element
Expand Down
4 changes: 4 additions & 0 deletions FlyingSocks/Sources/AsyncBufferedSequence+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
// SOFTWARE.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

package extension AsyncBufferedSequence where Element == UInt8 {

Expand Down
4 changes: 4 additions & 0 deletions FlyingSocks/Sources/AsyncSharedReplaySequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
// SOFTWARE.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

/// AsyncSequence that can be iterated multiple-times-concurrently.
package struct AsyncSharedReplaySequence<Base>: AsyncBufferedSequence, Sendable where Base: AsyncBufferedSequence {
Expand Down
4 changes: 4 additions & 0 deletions FlyingSocks/Sources/Socket+WinSock2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@

#if canImport(WinSDK)
import WinSDK.WinSock2
#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
import Synchronization

let O_NONBLOCK = Int32(1)
Expand Down
13 changes: 13 additions & 0 deletions FlyingSocks/Sources/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,21 @@
@_exported import WinSDK.WinSock2
#elseif canImport(Android)
@_exported import Android
#elseif canImport(Glibc) || canImport(Musl) || canImport(Bionic)
#if canImport(Musl)
import Musl
#elseif canImport(Bionic)
import Android
#else
import Glibc
#endif
#endif

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

public enum SocketType: Sendable {
case stream
Expand Down
12 changes: 12 additions & 0 deletions FlyingSocks/Sources/SocketAddress.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,23 @@
// SOFTWARE.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
#if canImport(WinSDK)
import WinSDK.WinSock2
#elseif canImport(Android)
import Android
#elseif canImport(Glibc) || canImport(Musl) || canImport(Bionic)
#if canImport(Musl)
import Musl
#elseif canImport(Bionic)
import Android
#else
import Glibc
#endif
#endif

#if canImport(CSystemLinux)
Expand Down
12 changes: 12 additions & 0 deletions FlyingSocks/Sources/SocketError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@
// SOFTWARE.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
#if canImport(Android)
import Android
#elseif canImport(Glibc) || canImport(Musl) || canImport(Bionic)
#if canImport(Musl)
import Musl
#elseif canImport(Bionic)
import Android
#else
import Glibc
#endif
#endif

public enum SocketError: LocalizedError, Equatable {
Expand Down
12 changes: 12 additions & 0 deletions FlyingSocks/Sources/SocketPool+Poll.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,20 @@
import WinSDK.WinSock2
#elseif canImport(Android)
import Android
#elseif canImport(Glibc) || canImport(Musl) || canImport(Bionic)
#if canImport(Musl)
import Musl
#elseif canImport(Bionic)
import Android
#else
import Glibc
#endif
#endif
#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

public extension AsyncSocketPool where Self == SocketPool<Poll> {
static func poll(interval: Poll.Interval = .seconds(0.01), logger: some Logging = .disabled) -> SocketPool<Poll> {
Expand Down
6 changes: 5 additions & 1 deletion FlyingSocks/Sources/SocketPool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
//

import Dispatch
#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

#if compiler(>=6.2)
public protocol EventQueue: SendableMetatype {
Expand Down Expand Up @@ -228,7 +232,7 @@ public final actor SocketPool<Queue: EventQueue>: AsyncSocketPool {
let events = waiting.resumeContinuation(id: id, with: result, for: socket)
try queue.removeEvents(events, for: socket)
} catch {
logger.logError("resumeContinuation queue.removeEvents: \(error.localizedDescription)")
logger.logError("resumeContinuation queue.removeEvents: \(error)")
}
}

Expand Down
4 changes: 4 additions & 0 deletions FlyingSocks/Sources/Task+Timeout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
// SOFTWARE.
//

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif

@available(*, unavailable, renamed: "SocketError.timeout")
public typealias TimeoutError = SocketError
Expand Down
3 changes: 0 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ let package = Package(
name: "FlyingSocksTests",
dependencies: ["FlyingSocks"],
path: "FlyingSocks/Tests",
resources: [
.copy("Resources")
],
swiftSettings: .upcomingFeatures
)
]
Expand Down
Loading