Files
swift-nio/Tests/NIOWebSocketTests/WebSocketFrameDecoderTest+XCTest.swift
T
Cory Benfield 708a62d257 Avoid delivering websocket frames twice on EOF. (#368)
Motivation:

Unfortunately as a result of #108 the WebSocketFrameDecoder can emit a
WebSocketFrame more than once if the user closes the connection in
channelRead, or any other callback while decode() is on the call stack.
This is obviously less than ideal, as it can allow multiple delivery of
frames.

Modifications:

Given WebSocketFrameDecoder a no-op implementation of decodeLast.

Result:

No multi-delivery of frames.
2018-04-27 11:02:51 +01:00

46 lines
2.2 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
//
// WebSocketFrameDecoderTest+XCTest.swift
//
import XCTest
///
/// NOTE: This file was generated by generate_linux_tests.rb
///
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
///
extension WebSocketFrameDecoderTest {
static var allTests : [(String, (WebSocketFrameDecoderTest) -> () throws -> Void)] {
return [
("testFramesWithoutBodies", testFramesWithoutBodies),
("testFramesWithExtensionDataDontRoundTrip", testFramesWithExtensionDataDontRoundTrip),
("testFramesWithExtensionDataCanBeRecovered", testFramesWithExtensionDataCanBeRecovered),
("testFramesWithReservedBitsSetRoundTrip", testFramesWithReservedBitsSetRoundTrip),
("testFramesWith16BitLengthsRoundTrip", testFramesWith16BitLengthsRoundTrip),
("testFramesWith64BitLengthsRoundTrip", testFramesWith64BitLengthsRoundTrip),
("testMaskedFramesRoundTripWithMaskingIntact", testMaskedFramesRoundTripWithMaskingIntact),
("testMaskedFramesRoundTripWithMaskingIntactEvenWithExtensions", testMaskedFramesRoundTripWithMaskingIntactEvenWithExtensions),
("testDecoderRejectsOverlongFrames", testDecoderRejectsOverlongFrames),
("testDecoderRejectsFragmentedControlFrames", testDecoderRejectsFragmentedControlFrames),
("testDecoderRejectsMultibyteControlFrameLengths", testDecoderRejectsMultibyteControlFrameLengths),
("testIgnoresFurtherDataAfterRejectedFrame", testIgnoresFurtherDataAfterRejectedFrame),
("testClosingSynchronouslyOnChannelRead", testClosingSynchronouslyOnChannelRead),
]
}
}