Commit Graph

21 Commits

Author SHA1 Message Date
Rick Newton-Rogers c73112efc0
Migrate CI to use GitHub Actions. (#213)
### Motivation:

To migrate to GitHub actions and centralised infrastructure.

### Modifications:

Changes of note:
* Adopt swift-format using rules from SwiftNIO. Modified so that it
ignores `NoAssignmentInExpressions` in some `XCTAssert` functions.
* Remove scripts and docker files which are no longer needed

### Result:

Feature parity with old CI.
2024-10-28 09:51:24 +00:00
Johannes Weiss 39ece4ed45
NIOSingletonsTransportServices: Use NIOTS in easy mode (#180)
Co-authored-by: Johannes Weiss <johannes@jweiss.io>
2023-08-09 03:29:24 -07:00
Cory Benfield 4e02d9cf35
Use Docc for documentation (#154)
Motivation

Documentation is nice, and we can help support users by providing useful
clear docs.

Modifications

Add Docc to 5.6 and later builds
Make sure symbol references work
Add overview docs

Result

Nice rendering docs
2022-07-29 15:02:01 +01:00
George Barnett 8ab824b140
Explicitly retain timer source when scheduling tasks (#138)
Motivation:

When a task is scheduled using a `DispatchTimerSource` on a `NIOTSEventLoop`
the source is retain via a callback on the promise associated with the
scheduled task. This stops the source from deinit'd before the task is
run. However, the callback being added is an implementation details of
`Scheduled` and the retain cycle is incidental.

If that detail chnaged (such as in
https://github.com/apple/swift-nio/pull/2011) then tasks may not run and
the promise could be leaked.

Modifications:

- Explicitly add a retain cycle between the future and the timer source
  which is broken by the promise being completed and callbacks run.

Result:

The timer source is kept alive until the event fires.
2022-01-12 10:37:50 +00:00
Cory Benfield e7f5278a26
Clean up imports and dependencies. (#130)
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 imports where necessary in tests.
- Note that the main package still _depends_ on NIO, which is necessary
  for backwards-compatibility reasons. This dependency is unused.

Result:

No need to use NIOPosix.
2021-09-14 10:06:42 +01:00
Peter Adams 9571a61d23
Move check for event loop shutdown into taskQueue (#127)
Motivation:

The event loop state is not protected for access on different threads.
This means it must only be accessed from the task queue.

Modifications:

Move check for event loop shutdown into taskQueue

Result:

Event Loop state only accessed from the task queue.
2021-08-19 10:57:47 +01:00
Gwynne Raskind 4eb9bebfb8
Per additional discussion and feedback in apple/swift-nio#1508, we're removing the message parameter from the precondition assertion methods entirely. Added a couple of missing @inlinables to match the declarations now present over there as well. (#85) 2020-05-07 12:50:39 +01:00
Gwynne Raskind fe7e340f41
Update `NIOTSEventLoop` per apple/swift-nio#1508 (#84)
Motivation:

See apple/swift-nio#1508 for rationale

Modifications:

Provides implementations of `preconditionInEventLoop(_:file:line:)` and `preconditionNotInEventLoop(_:file:line:)`.

Result:

NIOTSEventLoop will now use dispatchPrecondition(condition:) for the in/not in preconditions instead of relying on the default implementation, yielding improved correctness.
2020-05-07 10:27:27 +01:00
Johannes Weiss 409fddd45c
bootstraps: offer ELG validation (#76)
Motivation:

Today, we just expect the ELGs passed to the bootstraps to be the
correct ones, if not, we crash.

Modifications:

Offer an alternative validatingGroup: init that just returns nil
if the ELGs are of the wrong types.

Result:

Easier to work with multi-stack systems for example when the user might
pass an ELG for either NIO on Sockets or NIO on Network.framework.

This is the NIOTS companion for https://github.com/apple/swift-nio/pull/1464
2020-04-03 15:57:03 +01:00
Johannes Weiss cefc7014fc
fix license headers (#73) 2020-03-25 15:43:40 +00:00
Cory Benfield b0b3ba5e7f Make NIO Transport Services available on watchOS 6 (#47)
Motivation:

With Network.framework becoming available on watchOS, you should now be
able to run your favourite NIO applications on watchOS 6!

Modifications:

Updated availability annotations to allow NIO TS.

Result:

More NIO on more watches
2019-06-06 22:24:27 -07:00
George Barnett 3d0713dc43 Annotate code with availability attributes (#42)
* Annotate code with availability attributes

Motivation:

It was not possible to import NIOTS into a project where
Network.framework was not supported by all deployment targets.

Modifications:

All NIOTS code, where applicable, was annotated with availability
attributes.

Result:

It is possible for application developers to import NIOTS on platforms
which do not support Network.framework without a compile time error.
2019-05-10 19:02:02 +01:00
Johannes Weiss d68f9d1f8e make NIOTS compile on Linux (#29)
Motivation:

NIOTS will not work on Linux but we can at least make it not fail
compilation when compiled on Linux. That way consumers of the API can
depend on NIOTS but make sure they only use NIOTS when wrapped in a
`#if canImport(Network)` block.

Modification:

Guard everything by `#if canImport(Network)`

Result:

This package will now build on Linux (without providing any useful
code).
2019-03-25 16:49:35 +02:00
Johannes Weiss 1d0cb1040e
don't retain everything until connect timeout expires (#30)
Motivation:

Previously we would use the combination of DispatchQueue.asyncAfter and
a DispatchWorkItem for the connect timeout. If the connection succeeded
we would just cancel the DispatchWorkItem. Unfortunately that will still
keep everything that's captured in the DispatchWorkItem alive until the
deadline has come (because DispatchWorkItem is just a dumb wrapper over
a closure).

Modifications:

use a DispatchSource of type timer source instead.

Result:

- we won't keep the ELG/EL/Channel/... alive until at least the connect
  timeout expires.
- fixes #28
2019-03-22 15:40:02 +00:00
Cory Benfield 971a6a37ec Bring patches up to new NIO 2 master (#23) 2019-02-26 12:13:54 +00:00
Johannes Weiss 4587afdf46 port to latest NIO 2 APIs (#20)
Motivation:

Compiling code is good so let's make it compile again with the latest
NIO APIs.

Modifications:
- made NIOTS use `_NIO1APIShims`
- clicked 'Fix All' a couple of times to adjust the API

Result:
Code compiles again
2019-01-22 15:38:13 +00:00
Johannes Weiss 9fa52bd443 use to NIO 2 (from master branch) and Swift 5 (#18)
Motivation:

SwiftPM from Swift 5.0 brings targets that only support certain systems
which is really handy for this package as it only support macOS 10.14+
and iOS/tvOS 12+

Modifications:

- made use of the Swift 5.0 manifests which can have restrictions on the
  supported platforms
- adapted to NIO 2

Result:

- better development story
- using the latest & greatest
2019-01-18 13:03:21 +00:00
Cory Benfield fb5d37a1e1 Correctly hop across event loops during child channel setup. (#17)
Motivation:

We were inadvertently modifying the registration information of
NIOTSEventLoop objects from multiple threads, which is very not good.

Modifications:

Add an event loop execute to hop loops.

Result:

Thread safe!
2018-12-06 15:02:08 +00:00
Cory Benfield a9cece8a6d
Support preconditionInEventLoop. (#11)
Motivation:

In SwiftNIO 1.11 we shipped improved interfaces for Channels to support
asserting being in the event loop. This is necessary because Dispatch
provides no non-precondition way to 100% guarantee that you are on a
specific queue, which is a requirement for accurate behaviour of
inEventLoop.

Modifications:

- Added an implementation of preconditionInEventLoop.
- Changed all assertions to use new interface.
- Required NIO 1.11.

Result:

Accurate assertions
2018-11-06 17:44:41 +00:00
Jim Dovey e14a834008 Some cleanliness changes. (#7)
* Use DispatchWorkItem.cancel() for cancellation. Make StateManagedChannel.beginActivating() use the same methodology as all the others.

* A needless `if let x = opt` that could be replaced with a question mark.
2018-10-01 05:55:53 +01:00
Cory Benfield 6475881aea Initial commit 2018-07-18 17:11:24 +01:00