change NIOTSNetworkEvent initializers visibility to pubilc level (#148)

This commit is contained in:
František Mikš 2022-06-06 12:35:54 +02:00 committed by GitHub
parent 5a7a9b7875
commit e90ac29391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 2 deletions

View File

@ -31,12 +31,18 @@ public enum NIOTSNetworkEvents {
///
/// If you can handle this event, you should make a new connection attempt, and then
/// transfer your work to that connection before closing this one.
public struct BetterPathAvailable: NIOTSNetworkEvent { }
public struct BetterPathAvailable: NIOTSNetworkEvent {
/// Create a new `BetterPathAvailable` event.
public init(){ }
}
/// This event is fired when the OS has informed NIO that no better path to the
/// to the remote endpoint than the one currently being used by this `Channel` is
/// currently available.
public struct BetterPathUnavailable: NIOTSNetworkEvent { }
public struct BetterPathUnavailable: NIOTSNetworkEvent {
/// Create a new `BetterPathUnavailable` event.
public init(){ }
}
/// This event is fired whenever the OS has informed NIO that a new path is in use
/// for this `Channel`.
@ -57,6 +63,11 @@ public enum NIOTSNetworkEvents {
public struct ConnectToNWEndpoint: NIOTSNetworkEvent {
/// The endpoint to which we want to connect.
public let endpoint: NWEndpoint
/// Create a new `ConnectToNWEndpoint` event.
public init(endpoint: NWEndpoint) {
self.endpoint = endpoint
}
}
/// This event is fired as an outbound event when NIO would like to ask Network.framework
@ -66,6 +77,11 @@ public enum NIOTSNetworkEvents {
public struct BindToNWEndpoint: NIOTSNetworkEvent {
/// The endpoint to which we want to bind.
public let endpoint: NWEndpoint
/// Create a new `BindToNWEndpoint` event.
public init(endpoint: NWEndpoint) {
self.endpoint = endpoint
}
}
/// This event is fired when when the OS has informed NIO that it cannot immediately connect
@ -79,6 +95,11 @@ public enum NIOTSNetworkEvents {
/// Note that these reasons are _not fatal_: applications are strongly advised not to treat them
/// as fatal, and instead to use them as information to inform UI decisions.
public var transientError: NWError
/// Create a new `WaitingForConnectivity` event.
public init(transientError: NWError) {
self.transientError = transientError
}
}
}
#endif