Commit Graph
2140 Commits
Author SHA1 Message Date
Norman Maurer b0b9caa324 No need to do a syscall if the user wrote a empty buffer 2017-06-02 10:23:05 +02:00
Norman Maurer 488dcdcb5e Add methods to ByteBufferAllocator that allows wrapping existing Data 2017-06-01 19:24:35 +02:00
Norman Maurer 29b4ad373b Correctly distribute work across EVentLoops 2017-06-01 17:59:50 +02:00
Norman Maurer b915af9987 Rename write(string) to writeString(...), make it faster and add setter as well 2017-06-01 16:23:46 +02:00
Norman Maurer 89badeec24 Correctly reset the tail and also only set flush checkpoint one time 2017-06-01 13:09:17 +02:00
Norman Maurer 82309a5320 No need to check if in EventLoop if we already know this 2017-05-31 13:07:00 +02:00
Norman Maurer 9b79aba3b2 No need to convert to IOError if EWOULDBLOCK 2017-05-31 20:24:28 +02:00
Johannes Weiß ec47eb0677 specialise the syscall wrapper for Int/Int32 2017-05-31 19:02:36 +01:00
Kevin Clark 60c0ab1f6e ByteBuffer unit tests
Greatly improves unit test coverage on ByteBuffer.
2017-05-31 09:09:48 -07:00
Norman Maurer d5ac9b8b66 Add ClientBootstrap and so support for client side channels as well 2017-05-30 19:10:45 +02:00
Norman Maurer 13c0d1b672 Add a few more asserts to ensure we are really on the EventLoop 2017-05-30 14:27:40 +02:00
Norman Maurer cd67d7cd3b Use fast-path fire* methods when triggered from within the EventLoop thread 2017-05-30 14:22:26 +02:00
Norman Maurer c8eb940aa7 Add support for running multiple EventLoops 2017-05-30 14:09:02 +02:00
Norman Maurer ba57e459ba Remove internal as its the default anyway 2017-05-27 13:45:58 +02:00
Norman Maurer f788e03f5d Implement ByteBuffer.discardReadBytes and add unit test 2017-05-27 08:47:16 +02:00
Kevin Clark 594bb0fb39 Fix ByteBuffer.write(string:) 2017-05-26 22:31:19 -07:00
Norman Maurer 42a41e95d1 Share code between methods 2017-05-26 13:20:54 +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 3be0f15063 Simplify and tighten up access rights 2017-05-24 20:32:16 +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 82319a46b9 Code style fixes for enums 2017-05-24 12:08:40 +02:00
Norman Maurer 49733ebccf Introduce SelectorStrategy which allows different kinds of select events. This will be needed later on 2017-05-24 11:56:29 +02:00
Norman Maurer 172bd00305 Ensure if a flush0() is triggered because of InterestedEvent.Write / All that we only try to write the messages that where flushed by the user before. 2017-05-24 11:04:10 +02:00
Norman Maurer 5ad430322c Correctly use -1 when call epoll_wait(...) and so block until events are ready 2017-05-23 21:47:45 +02:00
Norman Maurer c1570dbfea Introduce ServerBootstrap which replaces NIOServer 2017-05-23 19:14:44 +02:00
Norman Maurer fc3359f40f Introduce ChannelError and use it for different cases 2017-05-23 15:35:05 +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 b33ad4b572 Add data set/get/write/read methods to ByteBuffer 2017-05-22 19:33:38 +02:00
Norman Maurer 3b0f013a6e Add slice(...) methods to ByteBuffer and fix a few bugs 2017-05-22 17:17:54 +02:00
Johannes Weiß ad1196f275 use swift-errno instead of duplicating the code 2017-05-22 16:24:41 +01:00
Norman Maurer 9286f4e221 Add methods to get / read / set / write Integer types to ByteBuffer 2017-05-22 13:57:49 +02:00
Norman Maurer 8ee1f99707 Only call fireChannelRegistered if the Channel was registered before 2017-05-21 09:10:14 +02:00
Norman Maurer 38edbe0f19 Simplify PendingWrites.consumeMultiple and add a few more asserts 2017-05-21 09:03:55 +02:00
Norman Maurer 5a9f8eab28 Make use of try? syntax and ensure we pass the correct Error to close0 all the time 2017-05-21 08:42:32 +02:00
Norman Maurer 44e78dd7e8 Use UIO_MAXIOV to calculate the writev limit on linux 2017-05-20 21:05:27 +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 5371cb649f Simplify code that fails all pending writes on close and ensure correct ordering of events 2017-05-19 21:26:03 +02:00
Norman Maurer 15eef4c0af Expose remote / local SocketAddress on Channel 2017-05-19 21:07:04 +02:00
Norman Maurer 461e82634d Ensure we deregister the Socket before call close so we never receive an EBADF 2017-05-19 20:36:56 +02:00
Norman Maurer d28a7573de Make swift-nio compile on linux as well 2017-05-19 20:34:12 +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
Johannes Weiß 8fb1162a7e fix missing constructor parameters 2017-05-19 00:03:06 +01:00
Norman Maurer 75a2c0bc49 Use linked-list datastructure to hold the pending writes. This gives some nice performance boost and better latency as well. 2017-05-18 22:51:17 +02:00
Johannes Weiß 2275423803 fix illegal buffer being passed to kernel (Data wasn't allocated yet) 2017-05-18 15:42:00 +01:00
Johannes Weiß 5bd5e887ae remove a bunch of unnecessary code 2017-05-18 15:45:52 +01:00
Norman Maurer a5323174dc Ensure we not leak the buffer and promise when EWOULDBLOCK is returned from write 2017-05-18 15:52:31 +02:00
Norman Maurer 54e510cbb8 Use lazy init as we need to pass in self to ChannelPipeline 2017-05-18 12:22:02 +02:00
Norman Maurer 08507cb47d Update to new Future-Swift tag and ensure we not leak Promises (as Future-Swift will enforce this) 2017-05-18 14:10:53 +02:00
Norman Maurer 63a8311349 Correctly forward all Errors through the ChannelPipeline and also fail hard if the user tries to use the ChannelHandlerContext after it was removed from the ChannelPipeline 2017-05-18 12:40:18 +02:00
Norman Maurer 83d1f86efb Introduce ChannelOption and use it to set / get config values 2017-05-18 07:35:55 +02:00