Commit Graph
26 Commits
Author SHA1 Message Date
Johannes Weiß 33fe401322 rename Future/Promise to EventLoopFuture/EventLoopPromise 2017-11-21 17:41:36 +00:00
Max (Swift) Moiseev 198d6b447b Explicit access modifiers on members in extensions 2017-11-18 04:40:26 -08:00
Johannes Weiß 6173bee782 Split IOData into NIOAny & IOData (ByteBuffer | FileRegion) 2017-10-25 19:31:27 +01:00
Johannes Weiss 1adb581f59 remove more Foundation imports 2017-10-10 16:25:43 +01:00
Johannes Weiß c09178ceb2 baby steps towards a type-safe Channel pipeline 2017-06-30 13:04:19 +01:00
Norman Maurer fd936557c4 Move Socket/* into NIO/ for max performance
Before:

`Bandwidth per channel: 18870.319⇅ Mbps (2358789.8 kBps)`

After:

`Bandwidth per channel: 21330.617⇅ Mbps (2666327.1 kBps)`
2017-07-03 14:52:09 +02:00
Norman Maurer 55fad73cd6 Introduce triggerUserOutboundEvent as this is a feature that we noticed is missing from netty 2017-07-03 09:56:16 +02:00
Norman Maurer 164cf244ac Swifty bind and connect method signature 2017-06-29 13:08:32 +02:00
Norman Maurer a9acf251e4 Have read and flush take an optional promise as well.
* Make Channel.read(...) take an optional promise so its more inline with the rest of the outbound operations

* Also let flush(...) take an optional promise and remove writeAndFlush(...)
2017-06-28 11:57:17 +02:00
Norman Maurer f35fb80c7e Make the promise optional for outbound operations.
This change allows the user to use `nil` as promise for outbound operations. This is useful if the user is not really interested in the outcome of the operations as it save extra allocations and so make things faster.

Before:
`Aggregate bandwidth: 10464.620↓, 10465.091↑ Mbps`

After (with using nil as Promise):

`Aggregate bandwidth: 11283.322↓, 11284.157↑ Mbps`
2017-06-27 14:37:24 +02:00
Norman Maurer dbb98eb905 Split ChannelHandler to ChannelInboundHandler and ChannelOutboundHandler
The mention change was done for performance reasons as often the user only either implement inbound or outbound operations per handler. The problem before was that we had to traverse the full list all the time even if the user was not really interested in either inbound or outbound events.

With this change we also split the doubly-linked-list into two linked-lists, one for inbound handlers and one for outbound handlers. This way we only need to traverse the handlers that are really interested in th event itself.

To give an idea about the impact of the change in terms of performance, here are some numbers.

Two ChannelInboundHandlers in the ChannelPipeline that do nothing and so just forward the events to the next handler in the pipeline:

Before:

`Bandwidth per channel: 18369.796⇅ Mbps (2296224.5 kBps)`

After:

`Bandwidth per channel: 20043.638⇅ Mbps (2505454.7 kBps)`
2017-06-21 14:35:33 +02:00
Norman Maurer 57cd379950 More consistent handling of writable state changes, so it matches netty 2017-06-19 15:05:29 +02:00
Johannes Weiß b73bfdab70 remove some existentials by specialising the data type (IOData) 2017-06-15 19:43:49 +01:00
Norman Maurer 58d0883b2d Fork Future-Swift and adjust it to ensure callback execution is always done on the EventLoop.
- Also remove all methods that use Dispatch for now as we not need these
- Ensure we will detect if the user calls a blocking method while on the EventLoop and crash to guard against deadlock
2017-06-12 13:44:10 +02:00
Norman Maurer c6685c3e7c Use types to allow the compile to specialize the methods 2017-06-09 15:47:10 +02:00
Norman Maurer db2002840d Add Channel.connect(...) and needed methods to Socket to support connect. This will allow us to support client and server easily in the future. 2017-05-24 22:13:17 +02:00
Norman Maurer 22d827f2da Mark methods with @discardableResult when its ok to discard the returned value 2017-05-24 14:17:40 +02:00
Norman Maurer f933093a1e Introduce ServerSocketChannel which will accept SocketChannel instances. Now the ServerSocket and the Socket are both handled directly via the EventLoop and make use of the pipeline just like in Netty. 2017-05-23 14:53:21 +02:00
Norman Maurer 0427eaff33 Add support for Channel.bind(...), this will also be needed once we support the ServerSocket via a Channel 2017-05-19 08:21:55 +02:00
Norman Maurer 53fe94869f Replace AnyObject with Any to allow passing classes and structs through the pipeline 2017-05-12 19:10:23 +02:00
Norman Maurer 7433a94743 Some visibility cleanup 2017-05-11 17:29:56 +02:00
Norman Maurer 6587222278 Make the pipeline more usable by adding add/remove/contains methods 2017-05-11 13:29:35 +02:00
Norman Maurer a2d301a4dc Replace AnyClass with AnyObject for user events 2017-05-10 07:49:22 +02:00
Norman Maurer 9780f68603 Use AnyObject for writes and reads to allow passing any object throught the pipeline 2017-05-10 07:42:28 +02:00
Norman Maurer 90d2e5a2e1 Add register and unregister callbacks 2017-05-09 19:23:39 +02:00
Norman Maurer e193bc97f0 Split into two different modules 2017-05-09 12:50:19 +02:00