Fail writes when stream closed by rststream

This commit is contained in:
Cory Benfield committed 2018-05-11 10:04:32 +01:00
1 parent 7aa92fe7e2
commit 95b557d617
6 files changed
+173 -9

No files matched your search

+32 -2
View File
@@ -12,9 +12,39 @@
//
//===----------------------------------------------------------------------===//
public protocol NIOHTTP2Error: Equatable, Error { }
/// Errors that NIO raises when handling HTTP/2 connections.
public enum NIOHTTP2Error: Error {
public enum NIOHTTP2Errors {
/// NIO's upgrade handler encountered a successful upgrade to a protocol that it
/// does not recognise.
case invalidALPNToken
public struct InvalidALPNToken: NIOHTTP2Error {
public init() { }
}
/// An attempt was made to issue a write on a stream that does not exist.
public struct NoSuchStream: NIOHTTP2Error {
/// The stream ID that was used that does not exist.
public var streamID: HTTP2StreamID
public init(streamID: HTTP2StreamID) {
self.streamID = streamID
}
}
/// A stream was closed.
public struct StreamClosed: NIOHTTP2Error {
/// The stream ID that was closed.
public var streamID: HTTP2StreamID
/// The error code associated with the closure.
public var errorCode: HTTP2ErrorCode
public init(streamID: HTTP2StreamID, errorCode: HTTP2ErrorCode) {
self.streamID = streamID
self.errorCode = errorCode
}
}
}