Commit Graph
2140 Commits
Author SHA1 Message Date
Norman Maurer 351d7c40d5 Cleanup code and remove old comments 2017-08-17 19:29:11 +02:00
Norman Maurer b2405eac44 Add support to schedule tasks on the EventLoop 2017-08-17 13:50:32 +02:00
Norman Maurer 4f91fe3f65 Fix possible infinite recursive loop when deregistering from the Selector throws an error while in close0 method 2017-08-16 19:36:50 +02:00
Norman Maurer 1619c3d7c8 Add support for sendFile by allow to write a FileRegion. 2017-08-11 20:32:04 +02: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
Johannes Weiß f42420f0d2 circular buffer for pending writes 2017-08-11 17:05:58 +01:00
Norman Maurer 24ce812c31 Ensure swift-nio compiles on latest swift 4.0 snapshot 2017-08-08 13:25:57 +02:00
Norman Maurer a708c33008 Fix Channel.connect(...) and add unit test that shows using swift-nio to build clients / servers work 2017-08-08 13:52:40 +02:00
Johannes Weiß b58d378869 fix ignoring SIGPIPE 2017-08-09 12:18:21 +01:00
Norman Maurer 16e0ffd9bf Allow to obtain remote and local address 2017-08-08 15:43:47 +02:00
Johannes Weiß 0684750261 minor fixes 2017-08-08 15:48:56 +01:00
Norman Maurer f71d82f3f4 Ensure flush and read promise are failed if Channel is already closed 2017-07-31 17:13:41 +02:00
Johannes Weiß 55bed8359b IPv6 support 2017-07-25 16:55:27 +01:00
Kevin Clark 78ba7a819e Make HTTPHeaders iterate with originalcase'd names
* Make HTTPHeaders iterate with originalcase'd names

Interface change as a consequence of this: now iterating headers
produces (name, value) tuples rather than (name, [values]).

* Add linux test wrapper

* Add case insensitive lookup test

* Update generate test headers

* Make HTTPHeadersIterator private
2017-07-24 12:55:12 -07:00
Norman Maurer 9f2aa75f9e Correctly extract address from enum when bind / connect.
Before this change binding a socket failed via:

NIO.IOError(errno: 22, reason: Optional("bind failed: errno(22) Invalid argument")):

This regression was introduced by 9485e583a7f8d6a0e1e36cfff05a8719f7c8c48e.
2017-07-23 14:44:08 +02:00
Johannes Weiß 0213e53f49 description for SocketAddress 2017-07-21 17:18:09 +01:00
Norman Maurer 2cc5151b8c Add precondition check for invalid writer / read index movement in the public methods. 2017-07-19 09:57:06 +02:00
Kevin Clark ed98bffe28 Renames and cleanup
* Massage HTTPHeaders

Simple had it's own version that was the same aside from a couple of
minor tweaks.

* Default initializer for HTTPHeaders

* Rename HTTPRequest -> HTTPRequestPart

* HTTPResponse -> HTTPResponsePart

* Add HTTPVersion(major:,minor:)

* Allow access to HTTPVersion.major/minor

* Comments on HTTP response codes

* Fix tests (needed rename applied)
2017-07-18 10:38:23 -07:00
Johannes Weiß 06ff146839 fix missing autoreleasepool & faster string -> bytes 2017-07-17 17:57:15 +01:00
Norman Maurer 7b2af6a03e Allow to pass the port as argument when starting the servers 2017-07-17 09:58:33 +02:00
Norman Maurer 6a8db51a53 Remove leftover 2017-07-10 21:03:53 +02:00
Norman Maurer 3c604f90dd Move ByteBuffer.string(...) to ByteBuffer-aux 2017-07-10 15:50:24 +02:00
Norman Maurer a9c9e0dc15 Http improve no copy
* Remove the need of the parseBuffer in the HTTPRequestDecoder and so remove a lot of memory copies.
2017-07-10 13:45:59 +02:00
Norman Maurer 829c0ccb9d Remove memory copy for each HTTP body part that is received 2017-07-09 13:25:43 +02:00
Norman Maurer 91b652fe8b Remove weak keywords as we nil out the pipeline reference when remove the context from the pipeline 2017-07-07 17:21:37 +01:00
Norman Maurer a28b1eb8d2 Tighten up access rights to methods 2017-07-07 17:30:42 +01:00
Norman Maurer 3d67e8da10 Remove duplicate asserts and assert that the Selectable is still open when used with the Selector 2017-07-07 10:52:37 +02:00
Norman Maurer ff1ab56ab2 Call pendingWrites.failAll(...) in a non delayed fashion to ensure closing of the Channel is reflected directly 2017-07-07 10:26:11 +02:00
Kevin Clark 145e8328c4 Futures init'd with errors/results are already fulfilled
* Futures init'd with errors/results are fulfilled

They automatically succeed/fail when new callbacks are added, so
semantically they're already fulfilled, no?

Without this, EventLoop.newSucceedFuture 'leaks' and explodes in the
provided tests.

* Regenerate linux tests

* Add missing generated extension for linux CI
2017-07-07 00:04:45 -07:00
Norman Maurer ef4cabc4b1 Ensure we not hold a lock while executing the tasks submitted to the EventLoop 2017-07-06 19:53:22 +02:00
Johannes Weiß 7467ab6a02 reduce dynamic type casting and checking 2017-07-06 18:47:15 +01:00
Norman Maurer 9d535bad22 Let writeInbound and writeOutbound signal if something was put in the buffer to consume and update the tests 2017-07-06 14:33:57 +02:00
Norman Maurer 2d235020d0 Add EmbeddedChannel.writeInbound|Outbound methods which make it easier to use EmbbeddedChannel for testing etc 2017-07-06 11:08:48 +02:00
Norman Maurer c12620e813 Directly use malloc/free when allocate ByteBuffer and also use realloc when change the size of the _Storage 2017-07-05 18:13:55 +02:00
Norman Maurer 980a7f013a Simplify allocation of http_parser and http_settings 2017-07-05 14:23:58 +02:00
Norman Maurer 6c06390909 Not call discardReadBytes() as this will produce an extra memory copy which is not needed as we rebuild the cumulation buffer anyway on the next message 2017-07-05 10:40:26 +02:00
Norman Maurer 354fd7f623 Use whenComplete(...) when register child channel 2017-07-04 21:04:51 +02:00
Norman Maurer 65fa14dc45 Correctly build HTTPVersion and dont create HTTPHeaders if not needed 2017-07-05 13:57:20 +02:00
Norman Maurer 4b1bc0afa9 EventLoop.submit(...) should use newPromise() for its promise creation to make it easer to implement 2017-07-04 20:10:45 +02:00
Johannes Weiß c09178ceb2 baby steps towards a type-safe Channel pipeline 2017-06-30 13:04:19 +01:00
Norman Maurer 614f689e05 Improve the EmbeddedChannel to be able to easily capture inbound and outbound messages 2017-07-04 12:16:00 +02:00
Norman Maurer c2c5c70610 Correctly handle eventfd_write error and also wrap as syscall 2017-07-04 09:02:49 +02:00
Norman Maurer 4127580f8b Port MessageToByteEncoder from netty 2017-07-04 08:45:40 +02:00
Norman Maurer 540c74b4ac Small cleanup 2017-07-04 08:58:45 +02:00
Norman Maurer c601d7683b We not depend on the errno module anymore 2017-07-03 19:50:32 +02: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 904150913d Add more remove(...) and context(...) methods to ChannelPipeline which allows to modify or retrieve stuff from the pipeline on the fly 2017-07-03 13:35:00 +02:00
Norman Maurer ba181bfd5c Detect user wakeup via the EVFILT_USER which is more safe 2017-07-02 19:36:17 +02:00
Norman Maurer 6e55eb0ade Rename InterestedEvent to IOEvent and reuse it in SelectorEvent to make things more consistent 2017-07-03 13:24:02 +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