Norman Maurer
19ac26e529
Correctly handle reregistrations for kqueue if InterestedEvents were .none before
2017-06-09 20:05:22 +02:00
Norman Maurer
fce361e337
Tighten up visibility to allow the optimizer doing a better job
2017-06-09 11:16:59 +02:00
Johannes Weiß
8d9c99b7cc
remove unused and illegal function
2017-06-08 15:14:58 +01:00
Johannes Weiß
d941745bdc
protect already closed sockets
2017-06-08 15:04:59 +01:00
Norman Maurer
12f8e0d6fc
Fix creation of timespec from milliseconds
2017-06-08 14:41:35 +02:00
Johannes Weiß
312f6824b5
writev optimisation
2017-06-06 17:26:25 +01:00
Johannes Weiß
216a74deaf
mini code cleanup
2017-06-05 16:20:00 +01:00
Norman Maurer
b03208b527
tighten up access rights
2017-06-02 21:20:27 +02:00
Johannes Weiß
ed3b79d227
port to latest errno wrapper
2017-06-02 19:50:16 +01:00
Johannes Weiß
cd4bb67138
make compatible with Swift 4 compiler (in Swift 3 mode)
2017-06-02 18:25:33 +01:00
Norman Maurer
15fe144107
Fix the build on linux after 773c722572e0d95277ca4137df180d06a53d8718
2017-06-02 19:01:22 +02:00
Johannes Weiß
2d97c8c25d
make the selector ready function take a closure instead of returning array
2017-06-02 17:34:08 +01: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
Norman Maurer
d5ac9b8b66
Add ClientBootstrap and so support for client side channels as well
2017-05-30 19:10:45 +02:00
Norman Maurer
c8eb940aa7
Add support for running multiple EventLoops
2017-05-30 14:09:02 +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
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
5ad430322c
Correctly use -1 when call epoll_wait(...) and so block until events are ready
2017-05-23 21:47:45 +02:00
Johannes Weiß
ad1196f275
use swift-errno instead of duplicating the code
2017-05-22 16:24:41 +01: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
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
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ß
f3ad6c308e
deallocate correct events capacity
...
Previously we allocated 2048 events and deallocated 1, fixed now.
2017-05-17 17:57:18 +01: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
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
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
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
Kevin Clark
3b3016b4f0
Use sterror on socket function errno
2017-05-09 17:10:58 -07: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
e193bc97f0
Split into two different modules
2017-05-09 12:50:19 +02:00