File tree 3 files changed +25
-3
lines changed
3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ import CSystemLinux
34
34
35
35
public extension AsyncSocketPool where Self == SocketPool < ePoll > {
36
36
static func ePoll( maxEvents limit: Int = 20 ) -> SocketPool < ePoll > {
37
- SocketPool ( queue: ePoll ( maxEvents: limit) )
37
+ SocketPool ( queue: FlyingSocks . ePoll ( maxEvents: limit) )
38
38
}
39
39
}
40
40
Original file line number Diff line number Diff line change @@ -63,6 +63,21 @@ public func makeEventQueuePool(maxEvents limit: Int = 20) -> AsyncSocketPool {
63
63
#endif
64
64
}
65
65
66
+ #if compiler(>=5.7)
67
+ public extension AsyncSocketPool where Self == SocketPool < Poll > {
68
+
69
+ static func make( maxEvents limit: Int = 20 ) -> SocketPool < some EventQueue > {
70
+ #if canImport(Darwin)
71
+ return . kQueue( maxEvents: limit)
72
+ #elseif canImport(CSystemLinux)
73
+ return . ePoll( maxEvents: limit)
74
+ #else
75
+ return . poll( interval: . seconds( 0.01 ) )
76
+ #endif
77
+ }
78
+ }
79
+ #endif
80
+
66
81
public final actor SocketPool < Queue: EventQueue > : AsyncSocketPool {
67
82
68
83
private( set) var queue : Queue
Original file line number Diff line number Diff line change @@ -37,13 +37,20 @@ final class SocketPoolTests: XCTestCase {
37
37
typealias Continuation = CancellingContinuation < Void , SocketError >
38
38
typealias Waiting = SocketPool < MockEventQueue > . Waiting
39
39
40
- #if canImport(Darwin)
40
+ #if canImport(Darwin) && compiler(>=5.7)
41
41
func testKqueuePool( ) {
42
- let pool = makeEventQueuePool ( )
42
+ let pool = SocketPool . make ( maxEvents : 5 )
43
43
XCTAssertTrue ( type ( of: pool) == SocketPool< kQueue> . self )
44
44
}
45
45
#endif
46
46
47
+ #if canImport(CSystemLinux) && compiler(>=5.7)
48
+ func testEPollPool( ) {
49
+ let pool = SocketPool . make ( maxEvents: 5 )
50
+ XCTAssertTrue ( type ( of: pool) == SocketPool< ePoll> . self )
51
+ }
52
+ #endif
53
+
47
54
func testQueuePrepare( ) async throws {
48
55
let pool = SocketPool . make ( )
49
56
You can’t perform that action at this time.
0 commit comments