Commit Graph
1096 Commits
Author SHA1 Message Date
Johannes Weiss 64a1c2feb8 Channel writes: unit tests & lots of fixes 2017-12-11 12:20:46 +00:00
Johannes Weiss 8a4a658bc7 fix large ByteBuffer allocations 2017-12-08 10:37:14 +00:00
Johannes Weiss b579f80efd in failAll we double accounted for outstanding ByteBuffers :( 2017-12-08 09:40:31 +00:00
Johannes Weiss 6383d9a704 don't leak registrations when SelectableEventLoop is closed 2017-12-08 09:37:12 +00:00
Johannes Weiß e1b30f0a3d fix Channel writes 2017-12-05 17:08:42 +00:00
Johannes Weiss 215620d7a6 syscall wrapper: don't do an allocation for every failed syscall 2017-12-07 15:37:12 +00:00
Norman Maurer ba46fc0f46 Add docs for Channel*Invoker 2017-12-06 15:01:18 +01:00
Norman Maurer 5475ba069a Add docs for IO and Selectable and also rename error parameter name to errorCode to ensure we not capture errno by mistake.
Motivation:

Explain here the context, and why you're making that change.
What is the problem you're trying to solve.

Modifications:

Describe the modifications you've done.

Result:

After your change, what will change.
2017-12-05 15:44:50 +01:00
Norman Maurer 56c1478dfb Add docs for SocketAddresses 2017-12-05 14:54:41 +01:00
Norman Maurer 2bfd69b980 Add docs for EventLoop
* Add docs for EventLoop

* Address comments
2017-12-05 13:54:12 +01:00
Johannes Weiss ff991da658 make the CircularBuffer implementation more straightforward & docs 2017-12-04 16:59:16 +00:00
Norman Maurer 1a9cd14118 More agressively try to increase the number of bytes we read from the Channel per read.
Motiviation:

We used to only allocate one buffer per read loop (by default we use multiple reads per loop) and record for the next loop iteration if we need to allocate a bigger buffer or not. This can lead to very slowely ramping up of number of bytes we read. We should better detect if we should allocate a new buffer because we used all the writable bytes to allow faster ramping up of numbre of bytes to read .

Modification:

- Change RecvByteBufferAllocator.record to return a Bool that wil lsignal if we used all the writable bytes of the last allocation and so may want to try to allocate a bigger buffer again
- Adjust tests.

Result:

Faster adjustment of the ByteBuffer capacity when reading data.
2017-12-04 15:43:13 +01:00
Johannes Weiss 9b593d0f8d ByteBuffer documentation (final part 2) 2017-12-04 11:51:17 +00:00
Johannes Weiß e1f1cd6d4d ByteBuffer docs, part 1 2017-11-30 16:42:58 +00:00
Johannes Weiss 98017432b8 dont require Foundation for IOError description creation 2017-12-01 14:31:37 +00:00
Johannes Weiss 557f8940f7 IOData docs 2017-11-30 17:49:28 +00:00
Johannes Weiß a22fc02c51 ByteBuffer: fix a UInt underflow 2017-11-30 16:57:26 +00:00
Johannes Weiss 3f38979347 documentation for NIOAny 2017-11-30 15:04:11 +00:00
Johannes Weiss 8335b6c3a0 replace priority queue 2017-11-28 16:13:26 +00:00
Cory Benfield 99188f3a99 Don't lose close promises 2017-11-21 19:00:36 +00:00
Johannes Weiß 06f9b1d63b merge ConcurrencyHelpers 2017-11-21 18:32:33 +00:00
Johannes Weiß 33fe401322 rename Future/Promise to EventLoopFuture/EventLoopPromise 2017-11-21 17:41:36 +00:00
Max (Swift) Moiseev 198d6b447b Explicit access modifiers on members in extensions 2017-11-18 04:40:26 -08:00
Max Moiseev 01b28a3f6d Simplify logic in guards (replace some with ifs instead) 2017-11-16 17:29:35 -08:00
Johannes Weiss 09b8925591 make ChannelHandlerCtx operations not crash if channel is already closed 2017-11-17 14:57:25 +00:00
Norman Maurer 68a475b37a Rename IOError.errno to IOError.errnoCode as errno is always in scope 2017-11-17 15:45:12 +01:00
Johannes Weiß b66d413a38 remove useless private method from StaticString extension 2017-11-17 13:33:20 +00:00
Norman Maurer 854aea060e Not creating IOError for EWOULDBLOCK
Motivation:

Creating an IOError is not "cheap" as we use String formatting to do so. In cases of EWOULDBLOCK we will never use the IOError at the end so we should not even create one.

Modifications:

Handle EWOUDLBOCK without creating and IOError

Result:

Less overhead when a syscall will fail because it would block
2017-11-17 13:06:29 +01:00
Norman Maurer f6d9bcc701 Make check for blacklisted errno an assert
Motivation:

Checking for blacklisted errno values should be an assert and not a precondition as this would signal a bug in our code itself and not something bad the user was doing. Also this will make the code smaller when compiling in release mode.

Modifications:

Change the blacklist check to be an assert.

Result:

Only check for blacklisted errno when asserts are enabled.
2017-11-17 08:20:50 +01:00
Johannes Weiß 936e812b32 make system call wrapper fast & test it 2017-11-16 15:42:03 +00:00
Cory Benfield 1cb736e370 Catch bugs with sync shutdown 2017-11-10 17:28:52 +00:00
Norman Maurer e67fc995cf Remove external depencies
Motivation:

We had a few external dependencies that were mainly used to include header files.

Modifications:

Add extra modules that will be used to export these headers.

Result:

Less external dependencies.
2017-11-16 15:20:13 +01:00
Norman Maurer ba35fcb5a5 Move all syscalls that also need to handle errno in an extra file and ensure we not get any problems with invalid errno handling
* Move all syscalls that also need to handle errno in an extra file and ensure we not get any problems with invalid errno handling

Motivation:

Because it is possible ARC cause an syscall and so set the errno value we need to ensure no ARC can ever happen before we were able to read the errno value that was caused by an syscall we made.

Modifications:

Move all syscalls to an extra file (System.swift) and ensure all exposed methods are marked with `@inline(never)` and not capture any classes. This ensures no ARC can ever happen.

Result:

Be able to safely read errno if needed.

* Comments
2017-11-16 16:41:19 +01:00
Cory Benfield 4cf0bbaaf4 Make our circular buffers collections 2017-11-16 12:56:29 +00:00
Johannes Weiß 31cd14eaad fix inEventLoop race and makes TSan happy 2017-11-10 14:56:33 -08:00
Cory Benfield 10f93fdca0 Minor fixups in Channel sending logic 2017-11-13 15:34:01 +00:00
Cory Benfield 8d2f13be68 Add parent property 2017-11-13 10:11:52 +00:00
Cory Benfield be81dbacff Forbid oversized writev calls 2017-11-10 16:08:49 +00:00
Cory Benfield 13d80285c8 Don't write too much to writev 2017-11-10 15:45:41 +00:00
Johannes Weiß 40edb34d8f introduce & test ByteBuffer.readString 2017-11-08 13:06:09 -08:00
Daniel Dunbar 6de5ea7c8b [NIOAny] Avoid need for force casts. 2017-11-09 19:33:17 -08:00
Johannes Weiss c18db56fc2 make >= 0 checks for index/length a precondition 2017-11-09 02:49:11 -08:00
Johannes Weiß 20800ed454 use the now fully featured FixedWidthInteger instead of EndiannessInteger 2017-11-08 13:08:02 -08:00
Norman Maurer 9bb7f6727d Use correct types in default method
Motivation:

The default method we added for the MessageToByteEncoder has the incorrect parameter types and so is useless.

Modifications:

Fix type of parameter.

Result:

Default method match the protocol requirement.
2017-11-08 01:14:43 -08:00
Norman Maurer 6d7928beb2 Remove ; from the code 2017-11-06 21:53:30 +01:00
Johannes Weiss 839a5050dd ByteBuffer: fast path for contiguous collections 2017-11-03 02:39:54 -07:00
Norman Maurer 22a35b2bdb Add FileRegion support when using HTTP
Motivation:

Often people want to transfer large files over http which should be done using sendfile(...) for best performance.

Modifications:

- Add support for using FileRegion when sending body parts.
- Add tests

Result:

Be able to serve files without loading these into memory
2017-11-01 16:02:14 +01:00
Cory Benfield 8b860d3009 Add SNI handler 2017-10-30 10:58:26 +00:00
Norman Maurer 9c7829a065 Port IdleStateHandler from Netty 2017-10-29 09:46:48 +01:00
Johannes Weiß 6173bee782 Split IOData into NIOAny & IOData (ByteBuffer | FileRegion) 2017-10-25 19:31:27 +01:00