Commit Graph

  • 2522fa68aa Swift 3.2 (Swift 4 in Swift 3 mode) needs TCO workaround Johannes Weiß 2017-06-08 16:10:22 +01:00
  • 02ff223eba add faster (Static)String write path Johannes Weiß 2017-06-08 16:09:56 +01:00
  • 37cca97422 rename ByteBuffer.data to ByteBuffer.backingData (to refuse confusion) Johannes Weiß 2017-06-08 16:09:19 +01:00
  • cd4866152d No need to allocate and free the iovec array all the time as we can just pin it on the EventLoop Norman Maurer 2017-06-08 15:45:48 +02:00
  • 8d9c99b7cc remove unused and illegal function Johannes Weiß 2017-06-08 15:14:58 +01:00
  • d941745bdc protect already closed sockets Johannes Weiß 2017-06-08 15:04:59 +01:00
  • 12f8e0d6fc Fix creation of timespec from milliseconds Norman Maurer 2017-06-08 14:41:35 +02:00
  • 0b78bbf4ed Not call EventLoop.reregister if the interestedEvents not changed Norman Maurer 2017-06-08 13:11:50 +02:00
  • 39715425d4 Guard against EBADF when processing write and read spin Norman Maurer 2017-06-08 12:52:51 +02:00
  • c0b9c691bb Correctly return true if the whole buffer is written. This regression was introduced by 9d00cf0191c33eaad5406f04112b318ad848e2c4 Norman Maurer 2017-06-08 12:15:43 +02:00
  • 751e3faef2 Fix EmbeddedChannelTest compile Kevin Clark 2017-06-07 16:44:56 -07:00
  • b3a98126f7 Fix unit tests broken in merge Kevin Clark 2017-06-07 11:25:01 -07:00
  • 65aa3f6bbd Use one EventLoop and adjust some options for the NIOEchoServer Norman Maurer 2017-06-07 19:21:13 +02:00
  • aa1f7d04ed Tighten up API and access rights Norman Maurer 2017-06-07 11:15:06 +02:00
  • 329b474f45 Initial impl of EmbeddedChannel Kevin Clark 2017-06-05 16:59:51 -07:00
  • bec8f64a13 Correctly update readerIndex of ByteBuffer when partial written. Fix regression introduced by 9d00cf0191c33eaad5406f04112b318ad848e2c4 Norman Maurer 2017-06-07 19:12:05 +02:00
  • 312f6824b5 writev optimisation Johannes Weiß 2017-06-06 17:26:25 +01:00
  • e8d60df8c2 Make naming more consistent and so make it more swift-like api Norman Maurer 2017-06-06 22:06:47 +02:00
  • bff55bbb3d Port write spin configuration option from netty Norman Maurer 2017-06-06 17:13:49 +02:00
  • 7d959a3b1a Not use lazy for perf reasons Norman Maurer 2017-06-06 14:51:10 +02:00
  • 2114a925aa Only use gathering write if we really have more then one buffer to write Norman Maurer 2017-06-06 12:37:13 +02:00
  • a59302ddbd Let the error be handled correctly from Channel.readable() Norman Maurer 2017-06-06 07:56:16 +02:00
  • d60a62ab80 Better handling of eof Norman Maurer 2017-06-06 07:51:40 +02:00
  • 216a74deaf mini code cleanup Johannes Weiß 2017-06-05 16:20:00 +01:00
  • f96227a35f Skip empty buffers when construct array for writev call Norman Maurer 2017-06-05 12:59:03 +02:00
  • b03208b527 tighten up access rights Norman Maurer 2017-06-02 21:20:27 +02:00
  • ed3b79d227 port to latest errno wrapper Johannes Weiß 2017-06-02 19:50:16 +01:00
  • 0fd639fc02 allow the usage of the Data slices API Johannes Weiß 2017-06-02 12:54:32 +01:00
  • cd4bb67138 make compatible with Swift 4 compiler (in Swift 3 mode) Johannes Weiß 2017-06-02 18:25:33 +01:00
  • 15fe144107 Fix the build on linux after 773c722572e0d95277ca4137df180d06a53d8718 Norman Maurer 2017-06-02 19:01:22 +02:00
  • 2d97c8c25d make the selector ready function take a closure instead of returning array Johannes Weiß 2017-06-02 17:34:08 +01:00
  • cc0e94bdc4 Remove unused method, which also did not respect the offset / readerIndex etc correctly Norman Maurer 2017-06-02 11:28:57 +02:00
  • 66b7a80888 Remove redundant assert checks Norman Maurer 2017-06-02 10:46:00 +02:00
  • b0b9caa324 No need to do a syscall if the user wrote a empty buffer Norman Maurer 2017-06-02 10:23:05 +02:00
  • 488dcdcb5e Add methods to ByteBufferAllocator that allows wrapping existing Data Norman Maurer 2017-06-01 19:24:35 +02:00
  • 29b4ad373b Correctly distribute work across EVentLoops Norman Maurer 2017-06-01 17:59:50 +02:00
  • b915af9987 Rename write(string) to writeString(...), make it faster and add setter as well Norman Maurer 2017-06-01 16:23:46 +02:00
  • 89badeec24 Correctly reset the tail and also only set flush checkpoint one time Norman Maurer 2017-06-01 13:09:17 +02:00
  • 2003126a04 Add Package.pins to gitignore for now Norman Maurer 2017-05-31 20:36:59 +02:00
  • 82309a5320 No need to check if in EventLoop if we already know this Norman Maurer 2017-05-31 13:07:00 +02:00
  • 9b79aba3b2 No need to convert to IOError if EWOULDBLOCK Norman Maurer 2017-05-31 20:24:28 +02:00
  • ec47eb0677 specialise the syscall wrapper for Int/Int32 Johannes Weiß 2017-05-31 19:02:36 +01:00
  • 60c0ab1f6e ByteBuffer unit tests Kevin Clark 2017-05-31 09:09:48 -07:00
  • d5ac9b8b66 Add ClientBootstrap and so support for client side channels as well Norman Maurer 2017-05-30 19:10:45 +02:00
  • 13c0d1b672 Add a few more asserts to ensure we are really on the EventLoop Norman Maurer 2017-05-30 14:27:40 +02:00
  • cd67d7cd3b Use fast-path fire* methods when triggered from within the EventLoop thread Norman Maurer 2017-05-30 14:22:26 +02:00
  • c8eb940aa7 Add support for running multiple EventLoops Norman Maurer 2017-05-30 14:09:02 +02:00
  • ba57e459ba Remove internal as its the default anyway Norman Maurer 2017-05-27 13:45:58 +02:00
  • f788e03f5d Implement ByteBuffer.discardReadBytes and add unit test Norman Maurer 2017-05-27 08:47:16 +02:00
  • 594bb0fb39 Fix ByteBuffer.write(string:) Kevin Clark 2017-05-26 22:31:19 -07:00
  • 42a41e95d1 Share code between methods Norman Maurer 2017-05-26 13:20:54 +02:00
  • 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. Norman Maurer 2017-05-24 22:13:17 +02:00
  • 3be0f15063 Simplify and tighten up access rights Norman Maurer 2017-05-24 20:32:16 +02:00
  • 22d827f2da Mark methods with @discardableResult when its ok to discard the returned value Norman Maurer 2017-05-24 14:17:40 +02:00
  • 82319a46b9 Code style fixes for enums Norman Maurer 2017-05-24 12:08:40 +02:00
  • 49733ebccf Introduce SelectorStrategy which allows different kinds of select events. This will be needed later on Norman Maurer 2017-05-24 11:56:29 +02:00
  • 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. Norman Maurer 2017-05-24 11:04:10 +02:00
  • 5ad430322c Correctly use -1 when call epoll_wait(...) and so block until events are ready Norman Maurer 2017-05-23 21:47:45 +02:00
  • c1570dbfea Introduce ServerBootstrap which replaces NIOServer Norman Maurer 2017-05-23 19:14:44 +02:00
  • fc3359f40f Introduce ChannelError and use it for different cases Norman Maurer 2017-05-23 15:35:05 +02:00
  • 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. Norman Maurer 2017-05-23 14:53:21 +02:00
  • b33ad4b572 Add data set/get/write/read methods to ByteBuffer Norman Maurer 2017-05-22 19:33:38 +02:00
  • 3b0f013a6e Add slice(...) methods to ByteBuffer and fix a few bugs Norman Maurer 2017-05-22 17:17:54 +02:00
  • ad1196f275 use swift-errno instead of duplicating the code Johannes Weiß 2017-05-22 16:24:41 +01:00
  • 9286f4e221 Add methods to get / read / set / write Integer types to ByteBuffer Norman Maurer 2017-05-22 13:57:49 +02:00
  • 8ee1f99707 Only call fireChannelRegistered if the Channel was registered before Norman Maurer 2017-05-21 09:10:14 +02:00
  • 38edbe0f19 Simplify PendingWrites.consumeMultiple and add a few more asserts Norman Maurer 2017-05-21 09:03:55 +02:00
  • 5a9f8eab28 Make use of try? syntax and ensure we pass the correct Error to close0 all the time Norman Maurer 2017-05-21 08:42:32 +02:00
  • 44e78dd7e8 Use UIO_MAXIOV to calculate the writev limit on linux Norman Maurer 2017-05-20 21:05:27 +02:00
  • 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. Norman Maurer 2017-05-19 15:28:15 +02:00
  • 5371cb649f Simplify code that fails all pending writes on close and ensure correct ordering of events Norman Maurer 2017-05-19 21:26:03 +02:00
  • 15eef4c0af Expose remote / local SocketAddress on Channel Norman Maurer 2017-05-19 21:07:04 +02:00
  • 461e82634d Ensure we deregister the Socket before call close so we never receive an EBADF Norman Maurer 2017-05-19 20:36:56 +02:00
  • d28a7573de Make swift-nio compile on linux as well Norman Maurer 2017-05-19 20:34:12 +02:00
  • 0427eaff33 Add support for Channel.bind(...), this will also be needed once we support the ServerSocket via a Channel Norman Maurer 2017-05-19 08:21:55 +02:00
  • 8fb1162a7e fix missing constructor parameters Johannes Weiß 2017-05-19 00:03:06 +01:00
  • 75a2c0bc49 Use linked-list datastructure to hold the pending writes. This gives some nice performance boost and better latency as well. Norman Maurer 2017-05-18 22:51:17 +02:00
  • 2275423803 fix illegal buffer being passed to kernel (Data wasn't allocated yet) Johannes Weiß 2017-05-18 15:42:00 +01:00
  • 5bd5e887ae remove a bunch of unnecessary code Johannes Weiß 2017-05-18 15:45:52 +01:00
  • a5323174dc Ensure we not leak the buffer and promise when EWOULDBLOCK is returned from write Norman Maurer 2017-05-18 15:52:31 +02:00
  • 54e510cbb8 Use lazy init as we need to pass in self to ChannelPipeline Norman Maurer 2017-05-18 12:22:02 +02:00
  • 08507cb47d Update to new Future-Swift tag and ensure we not leak Promises (as Future-Swift will enforce this) Norman Maurer 2017-05-18 14:10:53 +02:00
  • 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 Norman Maurer 2017-05-18 12:40:18 +02:00
  • 83d1f86efb Introduce ChannelOption and use it to set / get config values Norman Maurer 2017-05-18 07:35:55 +02:00
  • 66c02bf30b Ensure the EventLoop is currently only accessed from the same thread Norman Maurer 2017-05-18 08:58:47 +02:00
  • 3536fc1e62 Use static instances when possible to reduce memory usage and also allow to access Channel via ChannelPipeline Norman Maurer 2017-05-17 19:30:21 +02:00
  • ba5bf60aee Channel owns ChannelPipeline and ChannelConfig Johannes Weiß 2017-05-17 17:40:51 +01:00
  • f3ad6c308e deallocate correct events capacity Johannes Weiß 2017-05-17 17:57:18 +01:00
  • 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 Norman Maurer 2017-05-17 09:40:44 +02:00
  • fa979932e4 Remove some unnecessary assignments Norman Maurer 2017-05-17 08:22:50 +02:00
  • 8b0f2b68d9 Ensure we not leak promise on write failure (which mean result in memory leak). This was introduced by 7be608fcda47ed06051dc188d5e5b8bee56b8d68 Norman Maurer 2017-05-16 14:59:50 +02:00
  • 51764e1c6c Ensure Buffer.withMutable*Pointer returns an optional so its possible to signal back that a Socket can not read / write anymore Norman Maurer 2017-05-16 11:38:36 +02:00
  • 76a88539f7 More consistent naming by change RecvBufferAllocator to RecvByteBufferAllocator Norman Maurer 2017-05-16 08:23:36 +02:00
  • a256f4a424 Simplify and rearrange Norman Maurer 2017-05-16 08:21:57 +02:00
  • 7ef823a44a Port ByteBuf Kevin Clark 2017-05-15 22:30:49 -07:00
  • bb6cb9fa81 Simplify code which uses enums Norman Maurer 2017-05-15 22:46:53 +02:00
  • 4b4c3c2dbd Simplify eventloop handling Norman Maurer 2017-05-15 22:42:36 +02:00
  • 4336761b54 Correctly also handle EPOLLRDHUP Norman Maurer 2017-05-15 22:35:19 +02:00
  • 18a844a633 Cleaner handling for registering for InterestedEvents Norman Maurer 2017-05-15 22:32:52 +02:00
  • 13b7b61b9a Ensure we correctly handle EOF when read and also that we never re-register when the Channel was closed Norman Maurer 2017-05-15 20:26:07 +02:00