Skip to content

Commit

Permalink
Adopt Sendable in ChannelHandlers.swift (apple#2144)
Browse files Browse the repository at this point in the history
Co-authored-by: Cory Benfield <[email protected]>
  • Loading branch information
dnadoba and Lukasa authored Jun 1, 2022
1 parent 2f8d540 commit 6f119c2
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Sources/NIOCore/ChannelHandlers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ public final class AcceptBackoffHandler: ChannelDuplexHandler, RemovableChannelH
}
}

#if swift(>=5.7)
@available(*, unavailable)
extension AcceptBackoffHandler: Sendable {}
#endif

/**
ChannelHandler implementation which enforces back-pressure by stopping to read from the remote peer when it cannot write back fast enough.
It will start reading again once pending data was written.
Expand Down Expand Up @@ -152,6 +157,11 @@ public final class BackPressureHandler: ChannelDuplexHandler, RemovableChannelHa
}
}

#if swift(>=5.7)
@available(*, unavailable)
extension BackPressureHandler: Sendable {}
#endif

/// Triggers an IdleStateEvent when a Channel has not performed read, write, or both operation for a while.
public final class IdleStateHandler: ChannelDuplexHandler, RemovableChannelHandler {
public typealias InboundIn = NIOAny
Expand All @@ -160,7 +170,7 @@ public final class IdleStateHandler: ChannelDuplexHandler, RemovableChannelHandl
public typealias OutboundOut = NIOAny

///A user event triggered by IdleStateHandler when a Channel is idle.
public enum IdleStateEvent {
public enum IdleStateEvent: NIOSendable {
/// Will be triggered when no write was performed for the specified amount of time
case write
/// Will be triggered when no read was performed for the specified amount of time
Expand Down Expand Up @@ -336,3 +346,8 @@ public final class IdleStateHandler: ChannelDuplexHandler, RemovableChannelHandl
scheduledAllTask = nil
}
}

#if swift(>=5.7)
@available(*, unavailable)
extension IdleStateHandler: Sendable {}
#endif

0 comments on commit 6f119c2

Please sign in to comment.