Skip to content

Commit 253aef8

Browse files
committed
Add Sendable conformance
1 parent 30ab6a6 commit 253aef8

15 files changed

Lines changed: 28 additions & 23 deletions

Sources/Socket/Socket.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public struct Socket: Sendable {
140140
}
141141

142142
/// Listen for connections on a socket.
143-
public func listen(backlog: Int = Self.maxSocketBacklog) async throws {
143+
public func listen(backlog: Int = Self.maxBacklog) async throws {
144144
try await manager.listen(backlog: backlog, for: fileDescriptor)
145145
}
146146

@@ -168,7 +168,7 @@ public struct Socket: Sendable {
168168
public extension Socket {
169169

170170
/// Maximum queue length specifiable by listen.
171-
static var maxSocketBacklog: Int {
171+
static var maxBacklog: Int {
172172
Int(_SOMAXCONN)
173173
}
174174
}

Sources/Socket/SocketContinuation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99
import SystemPackage
1010

1111
#if DEBUG
12-
internal struct SocketContinuation<T, E> where E: Error, T: Sendable {
12+
internal struct SocketContinuation<T, E>: Sendable where E: Error, T: Sendable {
1313

1414
private let function: String
1515

Sources/Socket/SocketManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public protocol SocketManager: AnyObject, Sendable {
8080
}
8181

8282
/// Socket Manager Configuration
83-
public protocol SocketManagerConfiguration {
83+
public protocol SocketManagerConfiguration: Sendable {
8484

8585
associatedtype Manager: SocketManager
8686

Sources/Socket/System/FileChange.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public extension SocketDescriptor {
9696
}
9797

9898
@usableFromInline
99-
internal struct FileChangeID: RawRepresentable, Hashable, Codable {
99+
internal struct FileChangeID: RawRepresentable, Hashable, Codable, Sendable {
100100

101101
/// The raw C file handle.
102102
@_alwaysEmitIntoClient

Sources/Socket/System/FileEvent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import SystemPackage
33
/// File Events bitmask
44
@frozen
55
// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
6-
public struct FileEvents: OptionSet, Hashable, Codable {
6+
public struct FileEvents: OptionSet, Hashable, Codable, Sendable {
77

88
/// The raw C file events.
99
@_alwaysEmitIntoClient

Sources/Socket/System/FileFlags.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public extension FileDescriptor {
1111

1212
/// Options that specify behavior for file descriptors.
1313
@frozen
14-
struct Flags: OptionSet, Hashable, Codable {
14+
struct Flags: OptionSet, Hashable, Codable, Sendable {
1515

1616
/// The raw C options.
1717
@_alwaysEmitIntoClient

Sources/Socket/System/InternetProtocol.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import SystemPackage
22

33
/// Internet Protocol Address
44
@frozen
5-
public enum IPAddress: Equatable, Hashable, Codable {
5+
public enum IPAddress: Equatable, Hashable, Codable, Sendable {
66

77
/// IPv4
88
case v4(IPv4Address)
@@ -58,7 +58,7 @@ extension IPAddress: CustomStringConvertible, CustomDebugStringConvertible {
5858

5959
/// IPv4 Socket Address
6060
@frozen
61-
public struct IPv4Address: Equatable, Hashable, Codable {
61+
public struct IPv4Address: Equatable, Hashable, Codable, Sendable {
6262

6363
@usableFromInline
6464
internal let bytes: CInterop.IPv4Address
@@ -128,7 +128,7 @@ extension IPv4Address: CustomStringConvertible, CustomDebugStringConvertible {
128128

129129
/// IPv6 Socket Address
130130
@frozen
131-
public struct IPv6Address: Equatable, Hashable, Codable {
131+
public struct IPv6Address: Equatable, Hashable, Codable, Sendable {
132132

133133
@usableFromInline
134134
internal let bytes: CInterop.IPv6Address

Sources/Socket/System/MessageFlags.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/// Message Flags
33
@frozen
4-
public struct MessageFlags: OptionSet, Hashable, Codable {
4+
public struct MessageFlags: OptionSet, Hashable, Codable, Sendable {
55

66
/// The raw C file permissions.
77
@_alwaysEmitIntoClient

Sources/Socket/System/SocketAddressFamily.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/// POSIX Socket Address Family
33
@frozen
4-
public struct SocketAddressFamily: RawRepresentable, Hashable, Codable {
4+
public struct SocketAddressFamily: RawRepresentable, Hashable, Codable, Sendable {
55

66
/// The raw socket address family identifier.
77
@_alwaysEmitIntoClient

Sources/Socket/System/SocketFlags.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import CSocket
33

44
/// Flags when opening sockets.
55
@frozen
6-
public struct SocketFlags: OptionSet, Hashable, Codable {
6+
public struct SocketFlags: OptionSet, Hashable, Codable, Sendable {
77

88
/// The raw C file events.
99
@_alwaysEmitIntoClient

0 commit comments

Comments
 (0)