1
0
mirror of https://github.com/apple/swift-nio-extras.git synced 2025-05-21 21:09:34 +08:00

5 Commits

Author SHA1 Message Date
Rick Newton-Rogers
c198c58dc7 Sendability warnings 2024-10-28 11:45:46 +00:00
Rick Newton-Rogers
fc31edbdad Migrate CI to use GitHub Actions.
Motivation:

To migrate to GitHub actions and centralised infrastructure.

Modifications:

Changes of note:
* Adopt swift-format using rules from SwiftNIO
* Remove scripts and docker files which are no longer needed

Result:

Feature parity with old CI.
2024-10-25 16:24:19 +01:00
George Barnett
df34965cd7
Don't reserve capacity for NIOPCAPRingBuffer ()
Motivation:

The NIOPCAPRingBuffer can limit the number of fragment or the total
number of bytes in its buffer or both. When configuring the buffer to
limit only the maximum number of bytes it sets the maximum number of
fragments allowed to `.max`. On `init` the buffer has enough capacity
reserved to store tha maximum number of fragments.

This would be a large and potentially totally unnecessary allocation.
That is, if it didn't crash at runtime. It crashes at runtime as
`CircularBuffer` converts the requested capacity to a `UInt32` which
traps if you pass it an `Int.max`.

Modifications:

- Don't reserve capacity on init
- Adjust the test which tests the byte limit to not set a capacity as
  well

Result:

- `NIOPCAPRingBuffer(maximumBytes:)` doesn't crash
2023-11-03 10:04:31 +00:00
Cory Benfield
d66ae0557e
Clean up imports and dependencies. ()
Motivation:

With NIO 2.32.0 we broke the core NIO module up into modules that split
apart the POSIX layer and the core abstractions. As a result, this
package no longer needs to express a hard dependency on the POSIX layer.

Modifications:

- Rewrote imports of NIO to NIOCore.
- Added NIOEmbedded and NIOPosix imports where necessary in tests.
- Extended soundness script to detect NIO imports.
- Note that the main modules still depend on NIO, which is necessary
    for backwards-compatibility reasons. This dependency is unused.

Result:

No need to use NIOPosix.
2021-09-14 16:30:39 +01:00
Peter Adams
fe17f53108
Capture packets leading upto a user triggered event. ()
Motivation:

Capturing all packets is expensive. Recording to a ring buffer and
then outputting on a triggering event allows this cost to be reduced.

Modifications:

Add a new handler - NIOPCAPRingCaptureHandler.
This derives from the existing NIOWritePCAPHandler and generates PCAP recordings.
A ring buffer contained in this handler stores the captured packets until RecordPreviousPackets
is received as a user message at which point they are flushed to the sink.

Result:

There is a new handler capable of outputting packet captured data only in the build up to
a known event.

Co-authored-by: Cory Benfield <lukasa@apple.com>
Co-authored-by: George Barnett <gbrntt@gmail.com>
2020-07-24 13:55:12 +01:00