Commit Graph
2945 Commits
Author SHA1 Message Date
Daniel Alm 77d90255eb Significantly improve the performance of EventLoopFuture.{and,when}AllSucceed. (#943)
* Significantly improve the performance of `EventLoopFuture.{and,when}AllSucceed`.

* PR improvements.

* Add the fast track for `AllComplete` as well.

* Use `future.inEventLoop` instead of pointer comparison.
2019-04-05 10:56:36 +02:00
Johannes Weiss d1c9ed1d3f add some documentation around EventLoops (#944)
Motivation:

There were a bunch of docs missing around EventLoops.

Modifications:

Add some more docs.

Result:

Happier users, CC @ianpartridge :)
2019-04-03 19:30:06 +02:00
Liam Flynn df4e078c74 Add 2 missing server readme docs. (#940)
Add missing server readme docs for WebSocket server and UDP echo server.

Motivation:
With the exception of these two samples, all client and server examples have helpful readme docs.
Provides brief description of purpose of the sample code and how to run it.

Modifications:
Adds a readme to NIOUDPEchoServer.
Adds a readme to NIOWebSocketServer.

Result:
The samples for NIOUDPEchoServer and NIOWebSocketServer have a little explanation.
2019-04-02 11:28:31 +01:00
Johannes Weiss 3336cfaca3 README: Update prerequisites (#938) 2019-04-01 10:21:08 +01:00
Liam Flynn 0c74dfbbfb Update style in TCP Client and HTTP1Server examples. (#937)
Motivation:
There is a UDP echo client which is very similar to the NIOEchoClient.
The styles of these two examples should match closely so ‘diff’ comparing will show the pertinent API differences.

Modifications:
Add self tags to member variables in the TCP echo client.
Add a self tag to a member variable in the HTTP1 server.
Remove an assert from the echo client.

Result:
The code in the TCP and UDP examples now matches and fits the SwiftNIO style.
2019-03-31 19:56:42 +01:00
Johannes Weiss 8e59048aaf API docs: repo switcher
Motivation:

API docs should be cross-linked.

Modifications:

Cross-link them.

Result:

better API docs
2019-03-31 16:18:35 +01:00
Liam Flynn 65d6f63a39 UDP Echo Client Example. (#933)
* UDP echo client example.

Motivation:

There is a UDP echo server example but it does not currently have a machine client example.
The TCP echo server has both sample client and server examples and it would be preferable to match.
The UDP client connection also differs from both the UDP server and the TCP client, so it is good to provide and example of this difference.

Modifications:

Added a UDP client example and a matching readme file.
The main swift file is a similar to the TCP echo example as possible.

Result:

There is now a clear example of how to create a simple UDP client side connection.
2019-03-31 16:18:11 +01:00
Johannes Weiss bba988ece0 README: recommend 2.0.0, not 1.0.0 2019-03-29 15:43:37 +00:00
Johannes Weiss 2b0d2e4b30 minor docs additions & fixes (#930)
Motivation:

Just spotted a few small issues in the docs.

Modifications:

fix 'em

Result:

better docs.
2019-03-27 11:53:17 +00:00
Johannes Weiss 8d5994be5f update the podspec generator to require Swift 5.0 (#929)
Motivation:

Our podspecs should also correctly require Swift 5.

Modifications:

require Swift 5 in the podspec generator.

Result:

better podspecs for NIO2.
2019-03-26 15:50:55 +00:00
Johannes Weiss 09bace11d6 minor fixes in docs (#928)
Motivation:

Some things weren't 100% clear or wrong, let's fix em.

Modifications:

fixed 'em.

Result:

better docs
2019-03-26 11:26:10 +00:00
Johannes Weiss b8368b6e09 update the documentation for NIO 2 release (#927)
Motivation:

A bunch of things change with the release of NIO 2. We should update the
documentation to reflect that.

Modifications:

- update readme
- update migration guide

Result:

up to date docs.
2.0.0
2019-03-26 09:11:28 +00:00
Johannes Weiss 874a883e33 use Swift 5.0-RELEASE (#926)
Motivation:

Now that Swift 5 is released, we should use the release version.

Modifications:

switch to Swift 5.0-RELEASE.

Result:

newer, shinier
2019-03-26 08:49:10 +00:00
Johannes Weiss 95dade583a update contributors (#921) 2019-03-25 12:41:24 +02:00
Johannes Weiss 32b0be4626 DEVELOPMENT-SNAPSHOT-2019-03-10-a (#920) 2019-03-25 12:19:58 +02:00
Johannes Weiss d55c582e5c improve documentation (#919)
Motivation:

Spotted a couple of issues with the documentation and fixed them.

Modifications:

- explicitly marked all `public class`es as `public final class` to get
  consistency in the Jazzy documentation.
- removed `public` extension methods of the `internal struct
  PriorityQueue` which Jazzy showed in the docs.
- improved the largely missing `EmbeddedChannel` and `EmbeddedEventLoop`
  documentation.
- clear up lies in the B2MD docs
- add some other missing docs

Result:

better docs makes happier users
2019-03-25 12:09:16 +02:00
Konrad `ktoso` Malawski ef2f86bb24 Fix minor typo in RemovableChannelHandler api docs (#924) 2019-03-25 09:39:03 +02:00
Johannes Weiss 93646f544c remove unused CompositeError (#918)
Motivation:

CompositeError was completely unused, let's kill it.

Modifications:

remove CompositeError

Result:

fewer unused things
2019-03-23 16:41:17 +00:00
Johannes Weiss e0f8275ce3 Scheduled: Don't hold onto cancellationTask (#913)
Motivation:

For whatever reason, Scheduled stored the cancellationTask in two
places, one of them it never even used :).

Modifications:

only have the promise have a reference to the cancellationTask

Result:

- don't hold onto things longer than necessary
- shrink Scheduled by one word :)
2019-03-23 15:35:24 +00:00
Johannes Weiss df0b0594ec CircBuffer: docs: add that indices are no longer Strideable (#914)
Motivation:

CircularBuffer indices are no longer `Strideable`, document this.

Modifications:

added to the public api changes doc

Result:

better docs
2019-03-23 15:05:12 +00:00
Johannes Weiss a8fbcf080b EmbeddedChannel: remove mystery bools (#917)
Motivation:

EmbeddedChannel.finish/writeInbound/writeOutbound returned some mystery
bools. I always had to check the code to remember what they actually
meaned.

Whilst this is technically a breaking change, I couldn't find any users
of the return values on Github that are using the convergence releases.

Modifications:

Replace them by enums giving you all the information.

Result:

- fixes #916
- clearer APIs
2.0.0-convergence.4
2019-03-22 12:34:16 +00:00
Liam Flynn 169f34adfc Motivation: (#911)
The README file example list is missing a couple of examples which are actually in the project, namely the UDP and WebSocket server example projects.

Modifications:

Added UDP and WebSocket server example projects to the README.

Result:

A full list of examples is now included in the README file.
2.0.0-convergence.3
2019-03-20 15:37:08 +00:00
Johannes Weiss 164f9b12d6 less confusion for Jazzy (#910)
Motivation:

Jazzy adds everything that has a `public` modifier to the documentation,
even if a type is `internal` or `private`. So conforming and internal
type to some protocol and making all those functions `public` has the
effect of essentially documenting stuff that you can't call (as it's not
actually public).

Modifications:

- remove `public` from functions in extensions on types that aren't
  public
- change one `final public` to `public final` because Jazzy doesn't
  normalise that

Result:

better docs
2019-03-19 17:36:27 +00:00
Johannes Weiss cc25ee9a00 CircularBuffer: debug-only index validation (#909)
Motivation:

In the new CircularBuffer indices we had 24 spare bits, let's do
something useful with them: If it fits we can store the expected
collection size there and compare when an element is accessed through
that index.

Modifications:

add collection count to CircularBuffer.Index

Result:

we can somewhat validate the correct use of CircularBuffer indices
2019-03-19 15:23:17 +00:00
Johannes Weiss 4ffa858ce6 make HTTPMethod.hasRequestBody internal (#908)
* make HTTPMethod.hasRequestBody internal

Motivation:

HTTPMethod.hasRequestBody was unnecessarily public.

Modifications:

make it internal

Result:

fixes #151

* Update public-api-changes-NIO1-to-NIO2.md
2019-03-19 13:02:34 +00:00
Johannes Weiss d61dd17719 B2MD: check that EOF events are forwarded
Motivation:

Basically I just wasn't 100% sure that I implemented that the EOF events
are not only handled but also forwarded to the next handler in the
pipeline. Quite important.

Modifications:

To figure out if I had implemented that or not I just wrote a test which
this PR is adding.

Result:

One more test, nothing else. Turns out I had implemented that correctly.
2019-03-18 18:08:00 +00:00
Johannes Weiss 0f72b759cf conform ByteBufferView to DataProtocol
Motivation:

ByteBufferView should conform to DataProtocol.

Modifications:

Conform ByteBufferView to DataProtocol.

Result:

ByteBufferView conforms to DataProtocol.
2019-03-18 16:57:55 +00:00
Johannes Weiss 35ed9ff754 CircularBuffer: shrink indices to 1 word on 64-bit archs
Motivation:

CircularBuffer and its indices should be small. Also the implementation
of methods like remove/popFirst/Last was suboptimal.

Modifications:

- shrink CircularBuffer and its indices
- improve the conformances to the various collection related protocols
- make CircularBuffer self-slicing
- remove Strideable conformance from the indices

Result:

nicer CircularBuffer
2.0.0-convergence.2
2019-03-15 21:48:52 +00:00
Jovan Milenkovic 5409acdfb6 Add CircularBuffer Index implementation
Motivation:

Provide a way for CircularBuffer to directly access underlying buffer with an index instead of needing to calculate depending on current head index and underlying buffer count. Related issue: #682

Modifications:

Added needed properties to circular buffers Index and adjust CircularBuffer code accordingly.
Removed MarkedCircularBuffer assumption that an index into it's underlying buffer will not be invalidated.

Result:

CircularBuffer will have a complete Index implementation
2019-03-15 21:48:52 +00:00
Cory Benfield 8adf87baa6 Update migration guide with now-converging repos. (#905)
Motivation:

swift-nio-http2 and swift-nio-transport-services are now converging.

Modifications:

Updated the migration guide.

Result:

Docs will be up to date.
2019-03-15 15:03:01 +00:00
Johannes Weiss 205f317fd9 B2MH: helpful message if re-added to pipeline (#903)
Motivation:

B2MH used to crash a nil variable if re-added to a pipeline.

Modifications:

provide good error message for the crash instead

Result:

- fixes #902
2019-03-14 14:05:54 +00:00
Johannes Weiss ccd386b7db remove deprecated methods (#892)
Motivation:

There were some deprecated methods left on EventLoop.

Modifications:

remove them

Result:

- fixes #779
2019-03-13 18:02:26 +00:00
Johannes Weiss 357b931bda ByteBuffer: improve and simplify get* implementations (#896)
Motivation:

For historic reasons, the get* implementations checked the same indices
repeatedly and the checks were also repetitive.

Modifications:

unify and de-deplicate get* range checks

Result:

fixes #884
2019-03-13 17:35:34 +00:00
Johannes Weiss 08ae2308be migration guide: swift-nio-ssl has converged (#901)
Motivation:

We should have accurate information in our guides.

Modifications:

Note that swift-nio-ssl has converged.

Result:

correct info
2019-03-13 17:02:04 +00:00
Johannes Weiss ae3459aebf HTTPDecoder: remove rawURI (#899)
Motivation:

Before native UTF-8, the rawURI was a performance optimisation but
that's no longer true. Before this patch, we still had the rawURIs but
weren't using them at all.

Modifications:

remove any mention of rawURI

Result:

less clutter
2019-03-13 10:24:49 +00:00
Johannes Weiss b126287b78 test non-ASCII header name/value (#898)
Motivation:

Couldn't find a non-ASCII header name/value test.

Modifications:

added one

Result:

better tests
2019-03-12 11:26:21 +00:00
Johannes Weiss 87ee03c4ce ByteBuffer docs: gets are safe (#895)
Motivation:

ByteBuffer's get* methods are now safe, docs claimed they were unsafe
though.

Modifications:

Document the gets as safe

Result:

More correct docs.
2019-03-12 10:19:36 +00:00
Johannes Weiss bde02a6ef2 README.md: Update prerequisites (#897)
Motivation:

The prerequisites listed in README.md were outdated.

Modifications:

fix them

Result:

correct information is better information
2019-03-12 09:25:20 +00:00
Johannes Weiss 785f7620f2 fix wrong URL for swift-nio-extras 2019-03-08 19:30:39 +00:00
Johannes Weiss edda576522 update migration guide: convergence (#891)
Motivation:

Mention convergence in migration guide.

Modifications:

tell people about the correct dependencies in the migration guide.

Result:

happier users.
2019-03-08 19:30:02 +00:00
Johannes Weiss 36a52e1ea3 remove WebSocketFrameDecoder inline error handling (#885)
Motivation:

Follows on from the work done in #528 for #527: we have moved the the
default error handling out of WebSocketFrameDecoder, but had to leave
the code there for backward compatibility reasons. We can remove that
code now.

Modifications:

Removed automatic error handling code in WebSocketFrameDecoder.

Result:

- fixes #534
2.0.0-convergence.1
2019-03-08 19:11:39 +00:00
Johannes Weiss c6065cc367 MarkedCircularBuffer: don't used indices incorrectly (#890)
Motivation:

MarkedCircularBuffer was assuming that indices remain stable across
mutations, that's wrong.

Modifications:

Don't store the marked index but rather the offset from the start
instead.

Result:

MarkedCircularBuffer uses indices correctly.
2019-03-08 18:44:09 +00:00
Johannes Weiss 577604e850 disable NIO1APIShim's warning (#889)
Motivation:

We shouldn't put warnings in developer's code in the convergence phase.

Modifications:

- remove NIO1APIShims warning
- update Swift

Result:

fewer warnings
2019-03-08 18:10:03 +00:00
Johannes Weiss 15c1522cb4 NIONetworkInterface: Return if multicast is supported (#887)
this is a fixup and replacement of #650. We need to get this in because NIO converges.

Support for Interface to report if Multicast is supported. Channel can provide Error if Interface doesn't support Multicast.

Motivation:

Allows for checking if the interface you are setting up for Multicast even supports Multicast in the first place. In multiple projects we have done with Multicast it helps as we still run into some network managers that shutdown multicast support.

Modifications:

Interface exposes a new variable to determine if it supports Multicast.
performGroupOperation0 will check if interface is not nil and supports multicast, otherwise will throw error that the interface doesn't support Multicast

Result:

This should hopefully better inform if the Multicast attempt is going to even work.
2019-03-08 16:53:55 +00:00
Johannes Weiss acb37911c0 remove overloading from scheduleRepeatedTask (#886)
Motivation:

scheduleRepeatedTask had two overloads: for synchronous and asynchronous
tasks. They however had the same name so they were pretty much
impossible to use.

Modifications:

rename the asynchronous version of scheduleRepeatedTask to
scheduleRepeatedAsyncTask

Result:

- NIO easier to use
- fixes #882
2019-03-08 15:37:58 +00:00
Johannes Weiss e4774cc6e3 update documentation that EventLoopIterator is no longer optional (#888)
Motivation:

docs were old

Modifications:

update the EventLoopIterator examples
Result:

better docs
2019-03-08 15:21:07 +00:00
Johannes Weiss 3fcc5f9f08 Selector: make sure timerfd is level triggered (#880)
Motivation:

In the Selector (because of the deregistrationsHappened workaround) we
expect all events to be level triggered. If there are deregistrations,
we just expect epoll/kqueue to deliver the event again. But timerfd was
configured as `EPOLLET`. That means is a timer fires after some
deregistrations, we lose it.

Modifications:

make timerfd level triggered

Result:

- no more timer stalls
- fixes #872
2019-03-08 12:07:30 +00:00
Johannes Weiss 549ca82521 ELF: make everything inlinable (#846)
Motivation:

ELFs have loads of generic types and that basically screams allocations
and swift_getGenericMetdata everywhere because nothing was inlinable.

Modifications:

make everything inlinable

Result:

better performance working with ELFs
2019-03-07 11:29:04 +00:00
Johannes Weiss c6479eb1fc ByteBuffer.viewBytes now returns an Optional (#878)
Motivation:

ByteBuffer.viewBytes would unconditionally return a ByteBufferView even
if the requested bytes were not readable.

Modifications:

- make it return an `Optional<ByteBufferView>`

Result:

safer, better APIs
2019-03-07 09:12:53 +00:00
Johannes Weiss 22e6cd3c67 HTTP/1 headers simplification & cleanup (#857)
Motivation:

The HTTP/1 headers were quite complicated, CoW-boxed and exposed their
guts (being a ByteBuffer). In Swift 5 this is no longer necessary
because of native UTF-8 Strings.

Modifications:

- make headers simply `[(String, String)]`
- remove `HTTPHeaderIndex`, `HTTPListHeaderIterator`, etc

Result:

- simpler and more performant code
2019-03-06 18:11:40 +00:00