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
4 changes: 2 additions & 2 deletions Sources/NIOPosix/BaseSocketChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private struct SocketChannelLifecycleManager {
/// For this reason, `BaseSocketChannel` exists to provide a common core implementation of
/// the `SelectableChannel` protocol. It uses a number of private functions to provide hooks
/// for subclasses to implement the specific logic to handle their writes and reads.
class BaseSocketChannel<SocketType: BaseSocketProtocol>: SelectableChannel, ChannelCore {
class BaseSocketChannel<SocketType: BaseSocketProtocol>: SelectableChannel, ChannelCore, @unchecked Sendable {
typealias SelectableType = SocketType.SelectableType

struct AddressCache {
Expand Down Expand Up @@ -1419,7 +1419,7 @@ extension BaseSocketChannel {
}

/// Execute the given function and synchronously complete the given `EventLoopPromise` (if not `nil`).
func executeAndComplete<Value>(_ promise: EventLoopPromise<Value>?, _ body: () throws -> Value) {
func executeAndComplete<Value: Sendable>(_ promise: EventLoopPromise<Value>?, _ body: () throws -> Value) {
do {
let result = try body()
promise?.succeed(result)
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOPosix/BaseStreamSocketChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
import NIOCore

class BaseStreamSocketChannel<Socket: SocketProtocol>: BaseSocketChannel<Socket> {
class BaseStreamSocketChannel<Socket: SocketProtocol>: BaseSocketChannel<Socket>, @unchecked Sendable {
internal var connectTimeoutScheduled: Optional<Scheduled<Void>>
private var allowRemoteHalfClosure: Bool = false
private var inputShutdown: Bool = false
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOPosix/PipeChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
import NIOCore

final class PipeChannel: BaseStreamSocketChannel<PipePair> {
final class PipeChannel: BaseStreamSocketChannel<PipePair>, @unchecked Sendable {
private let pipePair: PipePair

internal enum Direction {
Expand Down
6 changes: 3 additions & 3 deletions Sources/NIOPosix/SocketChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extension ByteBuffer {
/// A `Channel` for a client socket.
///
/// - Note: All operations on `SocketChannel` are thread-safe.
final class SocketChannel: BaseStreamSocketChannel<Socket> {
final class SocketChannel: BaseStreamSocketChannel<Socket>, @unchecked Sendable {
private var connectTimeout: TimeAmount? = nil

init(eventLoop: SelectableEventLoop, protocolFamily: NIOBSDSocket.ProtocolFamily, enableMPTCP: Bool = false) throws
Expand Down Expand Up @@ -192,7 +192,7 @@ final class SocketChannel: BaseStreamSocketChannel<Socket> {
/// A `Channel` for a server socket.
///
/// - Note: All operations on `ServerSocketChannel` are thread-safe.
final class ServerSocketChannel: BaseSocketChannel<ServerSocket> {
final class ServerSocketChannel: BaseSocketChannel<ServerSocket>, @unchecked Sendable {

private var backlog: Int32 = 128
private let group: EventLoopGroup
Expand Down Expand Up @@ -451,7 +451,7 @@ final class ServerSocketChannel: BaseSocketChannel<ServerSocket> {
/// A channel used with datagram sockets.
///
/// Currently, it does not support connected mode which is well worth adding.
final class DatagramChannel: BaseSocketChannel<Socket> {
final class DatagramChannel: BaseSocketChannel<Socket>, @unchecked Sendable {
private var reportExplicitCongestionNotifications = false
private var receivePacketInfo = false

Expand Down
Loading