mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
Motivation:
Quite embarrasingly, we previously would only store one `ChannelOption`
per `ChannelOption` type. Most channel option types are distinct and
that's probably why it took so long to find this issue. Thanks
@pushkarnk for reporting. Unfortunately though, the most important
`ChannelOption` is `.socket` which crucially also holds a level and a
name. That means if you set two `ChannelOptions.socket` options with
distinct name/level, one would still override the other.
Example:
.serverChannelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEPORT), value: 1)
.serverChannelOption(ChannelOptions.socket(SocketOptionLevel(SOL_SOCKET), SO_REUSEADDR), value: 1)
would only actually set the latter.
Modifications:
- made all common `ChannelOption` types equatable (for 2.0 this will
be a protocol requirement)
- deprecated non-Equatable `ChannelOption` types
- zero out buffer before calling getsockopt as Linux doesn't do that
Result:
you can now set two distinct `ChannelOptions` for one type
Motivation:
Explain here the context, and why you're making that change.
What is the problem you're trying to solve.
Modifications:
Describe the modifications you've done.
Result:
After your change, what will change.
91 lines
3.6 KiB
Swift
91 lines
3.6 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// LinuxMain.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.
|
|
///
|
|
|
|
#if os(Linux) || os(FreeBSD)
|
|
@testable import NIOConcurrencyHelpersTests
|
|
@testable import NIOHTTP1Tests
|
|
@testable import NIOTLSTests
|
|
@testable import NIOTests
|
|
@testable import NIOWebSocketTests
|
|
|
|
XCTMain([
|
|
testCase(AcceptBackoffHandlerTest.allTests),
|
|
testCase(AdaptiveRecvByteBufferAllocatorTest.allTests),
|
|
testCase(ApplicationProtocolNegotiationHandlerTests.allTests),
|
|
testCase(Base64Test.allTests),
|
|
testCase(BaseObjectTest.allTests),
|
|
testCase(BlockingIOThreadPoolTest.allTests),
|
|
testCase(BootstrapTest.allTests),
|
|
testCase(ByteBufferTest.allTests),
|
|
testCase(ByteToMessageDecoderTest.allTests),
|
|
testCase(ChannelNotificationTest.allTests),
|
|
testCase(ChannelOptionStorageTest.allTests),
|
|
testCase(ChannelPipelineTest.allTests),
|
|
testCase(ChannelTests.allTests),
|
|
testCase(CircularBufferTests.allTests),
|
|
testCase(CompositeErrorTests.allTests),
|
|
testCase(CustomChannelTests.allTests),
|
|
testCase(DatagramChannelTests.allTests),
|
|
testCase(EchoServerClientTest.allTests),
|
|
testCase(EmbeddedChannelTest.allTests),
|
|
testCase(EmbeddedEventLoopTest.allTests),
|
|
testCase(EndToEndTests.allTests),
|
|
testCase(EventLoopFutureTest.allTests),
|
|
testCase(EventLoopTest.allTests),
|
|
testCase(FileRegionTest.allTests),
|
|
testCase(GetaddrinfoResolverTest.allTests),
|
|
testCase(HTTPDecoderLengthTest.allTests),
|
|
testCase(HTTPDecoderTest.allTests),
|
|
testCase(HTTPHeadersTest.allTests),
|
|
testCase(HTTPRequestEncoderTests.allTests),
|
|
testCase(HTTPResponseCompressorTest.allTests),
|
|
testCase(HTTPResponseEncoderTests.allTests),
|
|
testCase(HTTPServerClientTest.allTests),
|
|
testCase(HTTPServerPipelineHandlerTest.allTests),
|
|
testCase(HTTPServerProtocolErrorHandlerTest.allTests),
|
|
testCase(HTTPTest.allTests),
|
|
testCase(HTTPUpgradeTestCase.allTests),
|
|
testCase(HappyEyeballsTest.allTests),
|
|
testCase(HeapTests.allTests),
|
|
testCase(IdleStateHandlerTest.allTests),
|
|
testCase(IntegerTypesTest.allTests),
|
|
testCase(MarkedCircularBufferTests.allTests),
|
|
testCase(MessageToByteEncoderTest.allTests),
|
|
testCase(NIOConcurrencyHelpersTests.allTests),
|
|
testCase(NonBlockingFileIOTest.allTests),
|
|
testCase(PendingDatagramWritesManagerTests.allTests),
|
|
testCase(PriorityQueueTest.allTests),
|
|
testCase(SelectorTest.allTests),
|
|
testCase(SniHandlerTest.allTests),
|
|
testCase(SocketAddressTest.allTests),
|
|
testCase(SocketChannelTest.allTests),
|
|
testCase(SystemTest.allTests),
|
|
testCase(ThreadTest.allTests),
|
|
testCase(TypeAssistedChannelHandlerTest.allTests),
|
|
testCase(UtilitiesTest.allTests),
|
|
testCase(WebSocketFrameDecoderTest.allTests),
|
|
testCase(WebSocketFrameEncoderTest.allTests),
|
|
])
|
|
#endif
|