Norman Maurer
66c02bf30b
Ensure the EventLoop is currently only accessed from the same thread
2017-05-18 08:58:47 +02:00
Norman Maurer
3536fc1e62
Use static instances when possible to reduce memory usage and also allow to access Channel via ChannelPipeline
2017-05-17 19:30:21 +02:00
Johannes Weiß
ba5bf60aee
Channel owns ChannelPipeline and ChannelConfig
...
So `Channel -[strong]-> ChannelPipeline` and for the way back `ChannelPipeline -[unowned]-> Channel`
2017-05-17 17:40:51 +01:00
Johannes Weiß
f3ad6c308e
deallocate correct events capacity
...
Previously we allocated 2048 events and deallocated 1, fixed now.
2017-05-17 17:57:18 +01: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
fa979932e4
Remove some unnecessary assignments
2017-05-17 08:22:50 +02:00
Norman Maurer
8b0f2b68d9
Ensure we not leak promise on write failure (which mean result in memory leak). This was introduced by 7be608fcda47ed06051dc188d5e5b8bee56b8d68
2017-05-16 14:59:50 +02:00
Norman Maurer
51764e1c6c
Ensure Buffer.withMutable*Pointer returns an optional so its possible to signal back that a Socket can not read / write anymore
2017-05-16 11:38:36 +02:00
Norman Maurer
76a88539f7
More consistent naming by change RecvBufferAllocator to RecvByteBufferAllocator
2017-05-16 08:23:36 +02:00
Norman Maurer
a256f4a424
Simplify and rearrange
2017-05-16 08:21:57 +02:00
Kevin Clark
7ef823a44a
Port ByteBuf
...
This implements a heap based ByteBuffer modeled on Netty's ByteBuf. It provides read and write access via Unsafe{Mutable}Pointers (withReadPointer, withMutableWritePointer) and read access via withData. Instead of providing public access to mutating readIndex/writeIndex, the mutable withPointer methods take a closure returning the number of bytes written and automatically manages the applicable index.
Read and write helper methods still largely TODO.
2017-05-15 22:30:49 -07:00
Norman Maurer
bb6cb9fa81
Simplify code which uses enums
2017-05-15 22:46:53 +02:00
Norman Maurer
4b4c3c2dbd
Simplify eventloop handling
2017-05-15 22:42:36 +02:00
Norman Maurer
4336761b54
Correctly also handle EPOLLRDHUP
2017-05-15 22:35:19 +02:00
Norman Maurer
18a844a633
Cleaner handling for registering for InterestedEvents
2017-05-15 22:32:52 +02:00
Norman Maurer
13b7b61b9a
Ensure we correctly handle EOF when read and also that we never re-register when the Channel was closed
2017-05-15 20:26:07 +02:00
Norman Maurer
a4fc805685
Ensure we not re-register on the eventLoop once the channel was already closed
2017-05-15 19:32:08 +02:00
Norman Maurer
ec16d01c7c
Move ChannelHandlerContext class to ChannelPipeline.swift to be able to use fileprivate.
2017-05-15 11:46:29 +02:00
Norman Maurer
f6762500bb
Fix reference-cycles by using weak declarations
2017-05-15 11:35:17 +02:00
Norman Maurer
d626e49b2f
Make inEventLoop a property
2017-05-14 21:09:46 +02:00
Norman Maurer
466e16b2e4
Fix runtime error
2017-05-14 21:08:56 +02:00
Norman Maurer
d839ed1c52
Remove a few reference-cycles and so memory leaks
2017-05-14 20:41:38 +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
3565a4b8df
Use RecvBufferAllocator that is set in ChannelConfig
2017-05-11 19:43:48 +02:00
Norman Maurer
7433a94743
Some visibility cleanup
2017-05-11 17:29:56 +02:00
Norman Maurer
c18ef69652
Remove all handlers once a Channel is unregistered
2017-05-11 17:21:06 +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
41484d1c85
Add ChannelConfig and make a few things configurable
2017-05-11 12:44:01 +02:00
Norman Maurer
6f54d3cd3b
Cleanup init code
2017-05-11 08:15:33 +02:00
Norman Maurer
5c1cad3d2b
Remove uncessary while loop
2017-05-10 21:43:11 +02:00
Norman Maurer
8482c6aead
Ensure errno cant be changed before access it
2017-05-10 14:25:15 +02:00
Norman Maurer
69aeab14db
Ensure errno can not be changed between syscall and retrieving it
2017-05-10 14:10:10 +02:00
Norman Maurer
29ae2b547a
Better IOError messages for all classes in Sockets
2017-05-10 13:13:39 +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
Kevin Clark
3b3016b4f0
Use sterror on socket function errno
2017-05-09 17:10:58 -07:00
Kevin Clark
3153e3edf9
Make DefaultBufferAllocator#init public
2017-05-09 15:08:05 -07:00
Norman Maurer
a3f91cb364
Tighten up visibility
2017-05-09 20:30:36 +02:00
Norman Maurer
6a55209cb7
Only call accept() one time per EventLoop run
2017-05-09 20:21:49 +02:00
Norman Maurer
f79d81fb15
Move example that only uses the Sockets module into extra module
2017-05-09 20:14:47 +02:00
Norman Maurer
a5276fd4d1
Add methods to create promise / future from EventLoop
2017-05-09 20:07:34 +02:00
Norman Maurer
5bddfaca69
Add asserts to ensure we are calling everything from the EventLoop
2017-05-09 19:41:33 +02:00
Norman Maurer
91301591ea
Move register / deregister / reregister code to EventLoop
2017-05-09 19:33:31 +02:00
Norman Maurer
90d2e5a2e1
Add register and unregister callbacks
2017-05-09 19:23:39 +02:00
Norman Maurer
5a340fa626
Handle SIGPIPE
2017-05-09 15:25:13 +02:00
Norman Maurer
db81ee9e43
Also register for EPOLLERR to detect connection-reset fastly
2017-05-09 15:01:52 +02:00
Norman Maurer
4890ca6ed8
Cleanup after the split of modules and fix visibility
2017-05-09 14:16:03 +02:00
Norman Maurer
e193bc97f0
Split into two different modules
2017-05-09 12:50:19 +02:00
Norman Maurer
4d07554a2d
Expose Channel from pipeline / context
2017-05-09 12:14:38 +02:00
Norman Maurer
a8b2a2ec31
General cleanup and tighten up visibilities
2017-05-09 11:24:11 +02:00