Files
swift-nio/Tests
Felix SchlegelandCory Benfield 2ab733246c Close Channel when input & output are closed (#2450)
* Close Channel when input & output are closed

Motivation:

Suppose we have a channel whose input and output are closed.
On Linux, this currently results in a full socket closure (which means
TCP `RST` is being sent). This behaviour is currently different
on Darwin because we don't close our socket here when our input and output are
closed.

We should not have two different platform-dependent behaviours here.

As we cannot suppress the TCP `RST` on Linux, we have to align the
Darwin behaviour to the Linux behaviour meaning we close
our entire NIO channel when both the input and the output are closed.

Modifications:

* `BaseStreamSocketChannel`: escalate to full closure when both its
  input and its output are closed
* add new test
  `ChannelTests.testInputAndOutputClosedResultsInFullClosure()`
  verifying the desired behaviour

Result:

`BaseStreamSocketChannel` will now close entirely when both input and
output are closed.

* Review Cory

Modifications:

* `testInputAndOutputClosedResultsInFullClosure`:
    * prefix all server related variables with `server*`
    * assert that `serverConnectionChildChannel` becomes inactive once
      the `clientConnectionChannel` is fully closed

---------

Co-authored-by: Cory Benfield <lukasa@apple.com>
2023-06-29 02:30:36 -07:00
..
2023-04-17 08:40:35 +01:00
2023-04-17 08:40:35 +01:00