Motivation:
We've found following these conventions in the standard library simplifies
the code significantly if you create a lot of generic types that conform
to the std lib protocols.
Modifications:
Change the placeholder T to Element and remove now-unnecessary typealias.
Switch the name of the iterator to just Iterator, and have it re-use
the outer type's Element placeholder. Remove now-unnecessary typealiases.
Add deprecated typealiases to make this a non-breaking change.
Result:
Should be a non-functional change. Explicit typing outside the PriorityQueue
type would need to change, but there wasn't any.
Motivation:
The previous delayed upgrade test didn't really validate what it
claimed to be doing: it validated properties of the I/O, which made
it enormously flaky.
Modifications:
Change the tests to check for the presence/absence of the server
upgrade handler, which is a mark of the actual upgrade process.
Result:
Less flaky tests
Motivation:
The `addHandler` method is useful for creating extensions to add handlers similar to what Swift NIO offers w/ HTTP. For example:
```swift
extension ChannelPipeline {
func addPostgreSQLClientHandlers(first: Bool = false) -> EventLoopFuture<Void> {
return addHandlers(PostgreSQLMessageEncoder(), PostgreSQLMessageDecoder(), first: first)
}
}
```
Result:
Array and variadic accepting `ChannelPipeline.addHandler` methods are now available when importing the NIO module.
Motivation:
Our example servers used an arbitrary number of threads (the http one
just 1 :|) but `System.coreCount` is a much better default and also
demoes that API.
Modifications:
Changed the example servers to use `System.coreCount` threads.
Result:
Use more of the hardware you paid for.
Motivation:
When writing programs that use networks, particularly if you want to
perform multicast joins, it's extremely important to be able to query
network interfaces and get results.
Modifications:
Add support for querying interfaces using getifaddrs and wrap those query
results in a Swift class.
Result:
Users will be able to enumerate the interfaces on their machine.
Motivation:
Nicely written files end in newline characters.
Modifications:
Edited the test generation script to put a newline at the end of the
LinuxMain.swift file.
Result:
One more newline
Motivation:
Previously if we'd futureOnEL1.then { ... in futureInEL2 } we'd forget
to hop from EL1 to EL2 which is bad. Shout out to @tanner0101 for
reporting!
Modifications:
Hop from one EventLoop to another if needed.
Result:
thens between Futures of different EventLoops now correctly switch
EventLoops.
Motivation:
Sometimes a user needs to implement ChannelInboundHandler and ChannelOutboundHandler. We should remove some of the "boilerplate" code for doing so.
Modifications:
- Add ChannelDuplexHandler and use it.
Result:
Less boilerplate code.
Motivation:
The upgrade test would race with itself and occasionally fail.
Modifications:
Give enough time for all the work to settle before closing the
client channel.
Result:
No more flaky tests.
Motivation:
It's great if the new pull request dialog comes prefilled so the creator
gets an idea about what we'd like to know.
Modifications:
Added a PR template.
Result:
Hopefully better PR messages.
Motivation:
It's great if the GitHub issues come prefilled with a template.
Modifications:
Added a template very similiar to the commit one but md.
Result:
hopefully issues that are easier to action :)
Motivation:
We'd go into an infinite loop when trying to increase the capacity of a
0 capacity ByteBuffer *doh*. Thanks @vlm for reporting and writing the
test.
Modifications:
made sure ensureAvailableCapacity returns at least 1 if we don't have
enough capacity available.
Result:
0 capacity ByteBuffers resize now.
Motivation:
We should just use https for our dependency so the user not need to have a github user at all and no ssh configured.
Modifications:
Just use https
Result:
Easier to use and consume SwiftNIO
Motivation:
FileHandle and BaseSocket should implement a common protocol as these are both "based" on file descriptors
Modifications:
- Add FileDescriptor protocol
- Implement it for FileHandler and BaseSocket
Result:
Better code structure
Motivation:
Channel.open was not really needed as for our use-case Selectable already provides everything we need. Also how we used Channel.open in some scenarios was not really correct.
Modifications:
- Remove extension method.
- Rename property
- Remove out-dated comment.
- Fix usage of open
Result:
More clear and correct API
Motivation:
73a805c7f6 did some changes but missed to rename one variable. This broke the build on linux.
Modifications:
Rename fn to body.
Result:
Builds again on linux.
Motivation:
Sometimes we deviated from the style the Swift stdlib sets out for no
reason.
Modifications:
Fixed some stylistic deviations.
Result:
Looks more Swift-like.
Motivation:
We missed to check if the file descriptor is still open in ServerSocket before we act on it. We can remove a lot of complexity by just providing a withUnsafeFileDescriptor which will do this for us and use it through out the code-base.
Modifications:
Introduce withUnsafeFileDescriptor and use it to ensure we always only act on open Selectables.
Result:
More correct code.
Motivation:
set up continuous integration
Modifications:
* update docker file to include all dependencies required for build, unit tests, integration tests and doc generation
* remove dependency steps from doc generation script
* add integration tests driver script
Result:
able to set up docker based continuous integration
Motivation:
At the moment EmbeddedChannel calls fireChannelRegistered() when connect(...) is called. This is not correct, as it should be done when register(...) is called.
Modifications:
- Correctly call `fireChannelRegistered(...)` when register(...) is called
- Simplify init of EmbeddedChannel
- Fix EmbeddedChannelTest
Result:
Correct invocation of methods.
Motivation:
We sometimes used internal / public where fileprivate should have been used. Also we used a few return statements which were not needed.
Modifications:
Cleanup access levels and remove return.
Result:
Cleaner code
Motivation:
ChannelLifecycleHandler should record .registered as lifecycle in channelRegistered and not .inactive
Modification:
- Correct record .registered
- Fix tests
Result:
Correctly record lifecycle state.
Motivation:
Some of the docs for *Bootstrap could use some clarification. Also code examples were not formatted as such via markdown.
Modifications:
- Clarify docs
- Use code highlighting via markdown.
Result:
Better docs.
Motivation:
We used precondition for a few cases where it really checks for our own implementation. We should use assert here as there is nothing the user really can do to trigger it.
Modifications:
Replace precondition with assert.
Result:
Less overhead when in release mode and more correct in general.
Motivation:
Leaking a fd is bad we should at least assert that we not do.
Modifications:
Add assert in deinit so we crash in debug mode if we leak a socket.
Result:
Code is more robust.
Motivation:
We no longer have flush promises, so the PWM no longer needs to
handle them.
Modifications:
Removed all flush promise handling from the PWM and associated
tests.
Result:
Less code, more clarity.
Motivation:
A substantial chunk of code complexity exists in the PDWM to manage
flush promises. This complexity is no longer justified now that we
don't bother with them.
Modifications:
Removed much of the complexity of the PDWM handling of flush promises.
Result:
Simpler, easier to understand code.
Motivation:
We used Range for WriteBufferWaterMark which did not do any validation of the low and high marks.
Modifications:
Make WriteBufferWaterMark a struct and validate low and high values
Result:
More correct impl for watermarks.
Motivation:
We need to mount the ~/.ssh directory into the docker image as we use git@ to checkout our dependencies.
Modifications:
Use ~/.ssh as volume as well.
Result:
Be able to use docker images again.
Motivation:
When the connect() call does not complete synchronously we were not
updating the peer IP address when it finally did complete. This meant
that any channel that didn't connect synchronously (in the real world,
almost all of them) would not correctly see the remote peer IP.
Modifications:
Update the cached addresses on delayed connect.
Result:
Connected channels will see the correct remote IP.
Motivation:
We should include docs for our core abstractions. This adds docs for ChannelHandler and sub-protocols.
Modifications:
Add docs.
Result:
More docs.