Commit Graph

18 Commits

Author SHA1 Message Date
Cory Benfield fc80bf018b
Stop syncing onto queues. (#71)
Motivation:

Syncing onto the event loop queues is essentially never acceptable: we
can't appropriately guard against it going terribly wrong.

Modifications:

- Use locks instead, locks are good.

Result:

Removes some crashes.
Resolves #70.
2020-03-06 13:27:39 +00:00
Cory Benfield c7f06384dc Adopt NIOAtomic (#67)
Motivation:

We deprecated Atomic because we made a new, better one. We should use
it.

Modifications:

Replaced all use of Atomic with NIOAtomic.

Result:

Better performance, fewer compiler warnings.
2019-12-10 12:35:02 +00:00
Cory Benfield e30bf63ea1 Namespace ChannelOptions. (#61)
Motivation:

In NIO 2.9.0 we moved all first-party `ChannelOption` types into their
own namespace. That was a good idea, but NIOTS uses them too and so it
now encounters build warnings. Additionally, NIOTS defines its own
`ChannelOption`s, and so should namespace those as well.

Modifications:

- Updated the code to use the namespaced `ChannelOption` types.
- Namespaced our own.

Result:

More namespacing.
2019-10-23 17:26:25 -07:00
Cory Benfield 6cba688855 Correctly autoRead through the pipeline (#52)
Motivation:

When autoRead is on, the pipeline must observe the read calls in order
to be able to exert backpressure. Otherwise, autoRead is a
zero-backpressure mode, which isn't great.

Correctly call pipeline.read instead of self.read0 to avoid this.

Modifications:

- Updated NIOTSConnectionChannel to call pipeline.read().

Result:

Backpressure can be exerted.
2019-07-23 14:37:49 +01: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 15fe53093c update to latest NIO 2 (#26)
Motivation:

Code should compile and have the latest NIO 2 API.

Modifications:

- rename `ctx` to `context`
- apply all fixits

Result:

compiles again
2019-02-26 13:01:17 +00:00
Cory Benfield 971a6a37ec Bring patches up to new NIO 2 master (#23) 2019-02-26 12:13:54 +00:00
Cory Benfield 72f0815335 Support setting enablePeerToPeer. (#22) (#24)
Motivation:

Some users may wish to use peer-to-peer networking with bonjour.

Modifications:

Expose peer-to-peer networking via a new channel option.

Result:

Users will be able to use peer-to-peer networking

(cherry picked from commit e9c1e41fd1)
2019-02-11 13:12:18 +01: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 1761d4eafa Make Channel.isActive thread-safe. (#16)
Motivation:

Sadly I overlooked the fact that Channel.isActive is supposed to be
safe to call from multiple threads: the implementation here was not.

Modifications:

Store the active state into an Atomic.

Result:

It will be thread-safe to ask if a channel is active.
2018-12-06 12:22:58 +00:00
Cory Benfield 5840333f0a Support opting-out of Network.framework waiting state. (#15)
Motivation:

In some cases users may prefer not to wait for Network.framework to
reattempt connection in the future. Users should be able to opt-out of the
default waiting behaviour in those cases.

Modifications:

- Added WaitForActivity ChannelOption.

Result:

Users can configure channels better.
2018-12-03 11:28:20 +00:00
Cory Benfield 73f758b5da Remove invalid assertion. (#13)
Motivation:

It is possible to receive the dataReceived callback after we've called
cancel, mostly because there may be such a block in place in the queue
before that cancel call fires. We should tolerate that.

Modifications:

Removed the invalid assertion.

Result:

Fewer failures.
2018-11-15 10:47:01 +00:00
Johannes Weiss 833b152a21 better diagnostics if unsupported ChannelOption set (#12)
Motivation:

If the user sets an unsupported ChannelOption we should give the best
diagnostics possible.

Modifications:

Add the ChannelOption type to the error message that it's unsupported.

Result:

Happier users
2018-11-09 17:15:35 +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
Cory Benfield 955d1b91e7
Add support for SO_REUSEADDR and SO_REUSEPORT. (#1)
Motivation:

These are commonly-set socket options for channels, and we should
support them when using Transport Services as well.

Modifications:

Pass the socket options through to allowLocalEndpointReuse.

Result:

SO_REUSEADDR and SO_REUSEPORT will be available.
2018-08-08 17:22:02 +01:00
Cory Benfield 6475881aea Initial commit 2018-07-18 17:11:24 +01:00