mirror of
https://github.com/apple/swift-nio-extras.git
synced 2025-05-15 01:18:58 +08:00
Moves the decoder read state to inside the decoder class.
Motivation: To clarify that the read state is specific to that class type. Modifications: Moved the ‘DecoderReadState’ enumeration definition. Result: Neater code that is a little easier to follow.
This commit is contained in:
parent
899b9bfc92
commit
30aa84629e
@ -42,15 +42,6 @@ extension ByteLength {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// The state of a decoder. It has two distinct sections of data to read. Each must be fully present before it is considered as read.
|
||||
/// During the time when it is not present the decoder must wait. `DecoderReadState` details that waiting state.
|
||||
///
|
||||
private enum DecoderReadState {
|
||||
case waitingForHeader
|
||||
case waitingForFrame(length: Int)
|
||||
}
|
||||
|
||||
///
|
||||
/// A decoder that splits the received `ByteBuffer` by the number of bytes specified in a fixed length header
|
||||
/// contained within the buffer.
|
||||
@ -71,6 +62,16 @@ private enum DecoderReadState {
|
||||
///
|
||||
|
||||
public final class LengthFieldBasedFrameDecoder: ByteToMessageDecoder {
|
||||
|
||||
///
|
||||
/// The decoder has two distinct sections of data to read.
|
||||
/// Each must be fully present before it is considered as read.
|
||||
/// During the time when it is not present the decoder must wait. `DecoderReadState` details that waiting state.
|
||||
///
|
||||
private enum DecoderReadState {
|
||||
case waitingForHeader
|
||||
case waitingForFrame(length: Int)
|
||||
}
|
||||
|
||||
public typealias InboundIn = ByteBuffer
|
||||
public typealias InboundOut = ByteBuffer
|
||||
|
Loading…
x
Reference in New Issue
Block a user