Commit Graph

166 Commits

Author SHA1 Message Date
Cory Benfield 0194a62431
Adopt the Swift CoC (#177)
Motivation:

We're centralizing on the Swift code of conduct, so we'll x-reference
that instead of holding our own.

Modifications:

Hyperlink out to Swift.

Result:

Shared CoC across the projects.
2023-06-06 09:11:24 -07:00
David Nadoba 41f4098903
Use underscore version of `NIOPreconcurrencySendable` to silence warning (#173)
### Motivation
`swift-nio` has deprecated `NIOPreconcurrencySendable` in `2.51.0`. Removing the protocol conformance would be an API breaking change. Keeping the conformance is low cost and not worth the risk.

### Changes
- replace `NIOPreconcurrencySendable` with underscore version `_NIOPreconcurrencySendable`

### Result
We compile again with the latest `swift-nio` release without warnings
2023-04-25 15:00:26 +02:00
Si Beaumont dd408dc2d4
Drop support for Swift 5.5 (#172)
* Drop support for Swift 5.5

Signed-off-by: Si Beaumont <beaumont@apple.com>

* fixup: Next version will be 1.17.0

Signed-off-by: Si Beaumont <beaumont@apple.com>

---------

Signed-off-by: Si Beaumont <beaumont@apple.com>
2023-04-14 17:06:35 +01:00
Yim Lee 2dcb5a89e8
Add docker-compose file for Swift 5.9 (#170)
Co-authored-by: Cory Benfield <lukasa@apple.com>
2023-04-13 10:49:28 +01:00
Cory Benfield cf8315c87d
Drop Topics section (#171)
Motivation:

We try to support building our docs on Linux too, but that means we
can't explicitly reference any symbols from `index.md`.

Modifications:

Enable CI-ing docs.

Result:

Docs will render on Linux too.
2023-04-13 09:59:34 +01:00
Cory Benfield 59b966415d
Fix documentation and add infrastructure for CI-ing it (#169)
* Fix documentation and add infrastructure for CI-ing it

* Add 2023 to soundness
2023-04-11 13:35:16 +01:00
George Barnett 2c1fb7999d
Point docs to Swift Package Index (#168)
Motivation:

The NIO docs are now published on the Swift Package Index but the README
still refers to GitHub pages.

Modifications:

- Update README and other docs to point to Swift Package Index.

Result:

Documentation links work
2023-01-23 13:41:52 +00:00
David Nadoba cbfab6163c
Add Swift 5.8 CI and update nightly CI to Ubuntu 22.04 (#167) 2023-01-18 08:15:41 +01:00
Yim Lee 1a140b8c06
Add .spi.yml for Swift Package Index DocC support (#166) 2022-12-03 07:54:09 +00:00
Cory Benfield e676b1f044
Expose multicast service type (#165)
Motivation

As we've rolled out support for multicast on Linux, it makes sense to
add equivalent configuration for swift-nio-transport-services. The two
features aren't one-to-one, as Network.framework has substantially more
capability than the Linux functionality.

Modifications

- Expose a multipathServiceType channel option
- Add a test to confirm we use it properly

Result

Multicast service types are available.
2022-11-09 11:00:20 +00:00
carolinacass d3345ffc2a
Use #fileID/#filePath instead of #file (#164)
Motivation:

#fileID introduced in Swift 5.3, so no longer need to use #file anywhere

Modifications:

Changed #file to #filePath or #fileID depending on situation
2022-10-31 11:59:12 +00:00
David Nadoba c0d9a144cf
Allow retrieval of metadata from `NWConnection` (#163)
* Allow retrieval of metadata for a specific protocol from the underlying `NWConnection`

* Address review comments

* Address review comment

* Add availability annotation to tests

* Rename `NIOTSChannelIsNotATransportServicesChannel ` to `NIOTSChannelIsNotANIOTSConnectionChannel `
2022-10-19 15:59:33 +01:00
David Nadoba de5ea3d0b4
Fix Swift 5.5 (#162) 2022-10-13 14:47:28 +01:00
David Nadoba 330f4ee104
Remove `#if compiler(>=5.5)` (#161) 2022-10-13 12:50:25 +01:00
George Barnett 8fda939e1b
Raise minimum supported Swift version from 5.4 to 5.5 (#158)
Motivation:

SwiftNIO periodically drops support for older Swift versions. Now that
5.7 has been released, 5.4 will be dropped.

Modifications:

- Remove 5.4 specific Package.swift and docker-compose
- Update the 5.7 docker-compose to use the released 5.7 and move from
  focal (2004) to jammy (2204)
- Update docs

Results:

Minimum Swift version is 5.5
2022-09-29 01:23:09 -07:00
George Barnett b6e37a0d44
Add missing availability annotation to NIOTSConnectionBootstrap (#160)
Motivation:

- NIOTSConnectionBootstrap was extended to be marked as non-Sendable,
  this extenion missed the availability annotations.

Modifications:

- Add appropriate availability annotation

Result:

Resolves #159
2022-09-28 16:04:35 +01:00
Cory Benfield b39e53ad42
Replace Lock with NIOLock (#157)
Motivation:

Lock has been deprecated in favour of NIOLock. Warnings aren't great.

Modifications:

- Replace Lock with NIOLock
- Update the minimum required NIO version to 2.42.0.

Result:

Everything builds cleanly
2022-09-27 13:48:00 +01:00
carolinacass 5cd6fd45f7
Launching Services with existing NWConnection or NWListener objects (#156)
NIO Transport Services is not capable of launching services with existing NWConnection or NWListener objects. Being able to get
an existing NWConnection through a connection bootstrap and into a channel is a useful capability for advanced use cases.

Modifications:
* Added an option to bootstrap with existing NWListener and NWConnection
* Completed promise connection earlier within NIOTSChannels when AlreadyConfigured is called
* Added test with new NWConnection and NWListener to register Channels

Result:
Able to create and register a channel using an existing NWListener and NWConnection
2022-09-21 10:52:08 +01:00
David Nadoba c2e373fec5
Adopt `Sendable` (#155)
* Adopt `Sendable`

* Workaround Swift 5.4 compiler bug
2022-08-31 16:22:32 +01: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
David Nadoba 94645c8fcd
Use `swift-atomics` instead of `NIOAtomics` (#153) 2022-07-07 17:50:28 +01:00
Cory Benfield 605f7a4c55
Add defensive lifetime management for security metadata (#152)
Motivation:

Right now we're playing a little fast and loose with the lifetimes of
the sec_protocol_metadata_t. As a practical matter it is highly likely
that this is owned (and so kept alive by) the NWConnection, but rather
than risk that we should tighten up the lifetime management.

Modifications:

Use withExtendedLifetime to extend the lifetime.

Result:

Better lifetime management.
2022-07-05 09:25:11 +01:00
Cory Benfield acb6425a09
Use 5.7 nightlies. (#151) 2022-06-13 04:04:36 -07:00
George Barnett 2cb54f91dd
Remove outdated docs from README (#150)
Motivation:

We no longer support Cocoapods and `swift package generate-xcodeproj` is
deprecated, so we shouldn't advertise their usage in the README.

Modifications:

Remove Cocoapods and `swift package generate-xcodeproj` sections from
the README.

Result:

More up-to-date README
2022-06-09 14:46:12 +01:00
Cory Benfield 7d09200afa
Don't close when waiting unless we were asked to. (#149)
Motivation:

When we're waiting for connectivity, the user might tell us that they
aren't interested in waiting. In that case we take advantage of the
signal and close early.

However, the code as-written had a bug: we didn't care whether the user
told us they _didn't_ want to wait, or they _did_: we just closed
because they had an opinion! That's no good! We should only close if
they don't want to wait.

Modifications:

- Only close if the user doesn't want to wait.
- Add tests

Result:

We won't close if users don't want us to.
2022-06-07 14:36:37 +01:00
František Mikš e90ac29391
change NIOTSNetworkEvent initializers visibility to pubilc level (#148) 2022-06-06 03:35:54 -07:00
Cory Benfield 5a7a9b7875
Tweak testConnectingInvolvesWaiting to avoid invoking Private Relay (#146)
Motivation:

Private Relay kicks in to secure unencrypted data transfers, and
connections to port 80 are a good signal. As a result, the current
construction of this test will invoke Private Relay and attempt to route
over it.

While Private Relay is in beta this is a bad outcome, as it risks
causing bugs in unusual network scenarios. So let's tell Private Relay
we don't need it.

Modifications:

Pretend we're gonna connect to 443 instead.

Result:

More reliable test.
2022-05-25 07:41:33 -07:00
George Barnett 936bc0487a
Remove build_podspec.sh (#144)
Motivation:

We no longer support Cocoapods

Modifications:

- Remove build_podspec.sh

Result:

Fewer unused files
2022-05-04 11:03:16 +01:00
George Barnett cf4cd97ec2
Update podspec script (#143)
Motivation:

To workaround https://github.com/apple/swift-nio/issues/2073 we must
list all transitive dependencies when building podspecs.

Modifications:

- Include transitive dependencies in the build_podspec script
- The list of dependencies was generated using
  the `list_transitive_dependencies.py` from the NIO repo.

Result:

Podspec generation script includes transitive dependencies.
2022-05-03 09:58:06 +01:00
Fabian Fett 1a4692acb8
Fix warnings, that appeared after requiring Swift 5.4 (#142) 2022-04-21 09:12:31 -07:00
Fabian Fett b559a7303a
Drop support for Swift 5.2 and 5.3 (#141)
As outlined in a [Swift forums post in November ’21](https://forums.swift.org/t/swiftnio-swift-version-support/53232), SwiftNIO will only support the latest non-patch Swift release and the 2 immediately prior non-patch versions.

- drop support for Swift 5.2 and 5.3. 
- update CI for Swift 5.4 to run on bionic instead of focal to ensure that we still test bionic. 
- add a CI job for Swift 5.7
2022-04-20 08:54:39 +02:00
Cory Benfield 22d92ad93c
Add 5.6 nightly CI (#140)
* Add 5.6 nightly CI

The 5.6 nightly images are available, let's use them.

* Add 5.5 as well
2022-01-18 09:37:53 +00: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
George Barnett 5fd5ba4d3e
Use non-deprecated API for removing handlers (#125)
Motivation:

`removeHandlers(channel:)` was deprecated in NIO 2.32.0.

Modifications:

- Raise minimum required NIO version to 2.32.0
- Use `removeHandlers(pipeline:)`

Result:

We don't use deprecated API.
2021-08-17 18:01:25 +01:00
David Evans 39587bcecc
Update NIO to 2.30 (#123) 2021-06-23 14:16:15 +01:00
David Evans 0aecfe8b3a
Remove Swift 5.0 and 5.1 support, and add CI config (#122)
* Setup CI and update Package

* Rename sanity to soundness

* Apply suggestions from code review

Co-authored-by: Cory Benfield <lukasa@apple.com>

* Fix nightly docker config

Co-authored-by: Cory Benfield <lukasa@apple.com>
2021-06-23 08:57:00 +01:00
Johannes Weiss 188a295ee3
docker setup for main nightlies (#114) 2021-06-22 18:47:35 +01:00
Johannes Weiss 47fddadf83
stop publishing the executable products (#119) 2021-06-08 14:04:45 +01:00
George Barnett 657537c2cf
Add support for syncOptions to NIOTSListenerChannel and NIOTSConnectionChannel (#117)
Motivation:

NIO 2.27.0 added optional support for synchronous channel options.
NIOTSListenerChannel and NIOTSConnectionChannel should support this.

Modifications:

- Add synchronous options for NIOTSConnectionChannel and
  NIOTSListenerChannel
- Avoid an allocation in 'getOption' for each channel if the caller is
  already on the right event loop by using 'makeSucceededFuture'
- Remove a no longer used internal function and an already dead private
  helper

Result:

- Support for sync options and fewer allocations
2021-03-16 08:38:47 +00:00
George Barnett b9fd95b8d5
Add SECURITY.md (#116) 2021-03-09 11:14:29 +00:00
Johannes Weiss 1d28d48e07
update code of conduct to version 1.4 (#115) 2021-02-17 14:16:51 +00:00
Cory Benfield 5c90846c1b
Tolerate out-of-band ports. (#112)
Motivation:

We shouldn't crash if the user gives us a bad port.

Modifications:

- Check the ports are in-band before we move on.

Result:

We won't crash.
2021-01-27 14:37:00 +00:00
George Barnett 9fc0d32e07
Remove a redundant availability check (#109)
Motivation:

xcodebuild complains during Cocapods validation (which fails as a
result) about a redundant availability check. It's redundant because for
watchOS the availability guard on the outer scope has the same
conditions (for other platforms the conditions are tighter in the
inner scope). We never hit this before because we only recently added
watchOS to the supported platforms for Cocapods.

Modifications:

- Remove a redundant availability check

Result:

- Cocapods can validate without error
2020-11-27 09:27:39 +00:00
Cory Benfield 5a352330c0
Remove agressive precondition in zero-length-writes. (#108)
Motivation:

The zero-length writes handler will crash if it receives channelInactive
before channelActive. Sadly, that's totally possible if a channel is
closed from the connect promise.

Modifications:

- Tone back the preconditions a bit.
- Add a test that triggers this path.

Result:

Channel handler behaves better on early close
2020-11-24 13:21:50 +00:00
George Barnett 18c17b9ae0
Add watchOS deployment to PodSpec build script (#107)
Motivation:

We support watchOS 6+ with SwiftNIO Transport Services; as such we should
include watchOS as a deployment target for our CocoaPods.

Modifications:

- Add a watchOS deployment target to `build_podspecs.sh`

Result:

Users can deploy to watchOS 6+ with CocoaPods.
2020-10-19 10:11:40 +01:00
Cory Benfield 698e0eed47
We use the main branch now. (#105) 2020-09-24 16:28:15 +01:00
Cory Benfield bb56586c4c
Avoid crashing when connecting to empty host. (#103)
Motivation:

Network.framework will crash when we attempt to connect to the host
string "". That's not ideal, so we should detect that case and avoid it.

Modifications:

- Add code to detect the empty host string.

Result:

No crashes when accidentally connecting to "".
2020-08-11 10:10:17 +01:00
Peter Adams 71dbab3f12
Fix docker shell to use correct image. (#102)
Motivation:

Docker shell was incorrectly using the swift-nio docker image
rather than the swift-nio-transport-services one.

Modifications:

Change docker compose file to use the correct image.

Result:

Correct image will be used for docker shell.
2020-08-04 09:23:12 +01:00