Commit Graph
36 Commits
Author SHA1 Message Date
Norman Maurer 8f1ad37edd Use camel case for ChannelOption factory values and add docs 2017-12-20 14:18:07 +01:00
Johannes Weiss dfd25bf576 refactor Channel initialisation & *Bootstrap docs 2017-12-13 15:42:54 +00:00
Johannes Weiß eaf658691c some grammar fixes 2017-12-19 15:23:26 +00:00
Johannes Weiß 31cd14eaad fix inEventLoop race and makes TSan happy 2017-11-10 14:56:33 -08:00
Johannes Weiß 6173bee782 Split IOData into NIOAny & IOData (ByteBuffer | FileRegion) 2017-10-25 19:31:27 +01:00
Daniel Dunbar 87a47c88fc Prefer let bindings in port binding parsing. 2017-10-27 23:49:33 -07:00
Johannes Weiss 1adb581f59 remove more Foundation imports 2017-10-10 16:25:43 +01:00
Johannes Weiß 8e06697362 fix EventLoop shutdown by introducing shutdownGracefully 2017-09-20 17:15:06 +01:00
Cory Benfield 007feec636 Add Unix domain socket support part 2: Electric Boogaloo
* support UNIX Domain Sockets

* Add test for connect: with UDS path

* Add UDS-special connect method
2017-09-21 15:26:37 +01:00
Norman Maurer 1c469541a9 Force unwrap localAddress() as this should never be nil here and so fix the compiler warnings 2017-08-11 20:37:43 +02:00
Norman Maurer 16e0ffd9bf Allow to obtain remote and local address 2017-08-08 15:43:47 +02:00
Johannes Weiß 55bed8359b IPv6 support 2017-07-25 16:55:27 +01:00
Norman Maurer 7b2af6a03e Allow to pass the port as argument when starting the servers 2017-07-17 09:58:33 +02:00
Johannes Weiß c09178ceb2 baby steps towards a type-safe Channel pipeline 2017-06-30 13:04:19 +01:00
Norman Maurer 122360f812 Mark class ass private final 2017-07-01 14:10:36 +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
Tom Doron a6bae8b759 linux support
motivation: be able to build and test on linux

changes:
* add dockerfile to create docker image running all toold required for testing on linux
* add readme with instruction on how to use the docker setup
* add script to generate linux tests mapping
* add .swift_version file to explicitly call out the swift version needed to build the project
* adjust code that did not build on linux, mainly casting between Int32 and Int
2017-06-21 10:58:28 -07: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 2ca36ad86a Remove duplicated code and also remove @discardResult where it makes no sense 2017-06-16 13:14:23 +01: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 c0a2810840 Port AdaptiveRecvByteBufferAllocator from netty and make it the default 2017-06-12 09:13:21 +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 65aa3f6bbd Use one EventLoop and adjust some options for the NIOEchoServer 2017-06-07 19:21:13 +02:00
Norman Maurer c8eb940aa7 Add support for running multiple EventLoops 2017-05-30 14:09:02 +02:00
Norman Maurer c1570dbfea Introduce ServerBootstrap which replaces NIOServer 2017-05-23 19:14:44 +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 275e69be63 Add support for gathering writes to Socket and also ensure Channel will automatically use gathering writes if you call Channel*.write multiple times followed by a flush.
Beside this I removed the Socket.write and Socket.read method that takes an offset as these are redundant with just pass in a subrange of Data.
2017-05-19 15:28:15 +02:00
Norman Maurer 83d1f86efb Introduce ChannelOption and use it to set / get config values 2017-05-18 07:35:55 +02:00
Norman Maurer d462b007d7 Remove backpressure handling from Channel itself and implement it in a generic ChannelHandler, this makes it more flexible for the user what to do 2017-05-17 09:40:44 +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 6587222278 Make the pipeline more usable by adding add/remove/contains methods 2017-05-11 13:29:35 +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 4890ca6ed8 Cleanup after the split of modules and fix visibility 2017-05-09 14:16:03 +02:00