fix limits on 32-bit systems to values that work (#580)

Motivation:

We should have different constants for 32-bit systems where necessary
for example all the maximums should be Int32.max and not UInt32.max
because UInt32.max doesn't fit into an Int on 32-bit platforms. But
where unnecessary 32-bit and 64-bit should share maximum values.

Modifications:

- removed some constraints that should be unnecessary
- skip tests that can't work on 32-bit systems

Result:

better and more consistent 32-bit runs
This commit is contained in:
Johannes Weiss authored and GitHub committed 2018-08-23 10:38:47 +01:00
1 parent 7de224eaf3
commit aaf434022f
8 files changed
+41 -67

No files matched your search

@@ -16,13 +16,12 @@ import NIO
private let maxOneByteSize = 125
private let maxTwoByteSize = Int(UInt16.max)
#if arch(arm) // 32-bit, Raspi/AppleWatch/etc
// Note(hh): This is not a _proper_ fix, but necessary because
// other places extend on that. Should be fine in
// practice on 32-bit platforms.
private let maxNIOFrameSize = Int(Int32.max / 4)
#if arch(arm) || arch(i386)
// on 32-bit platforms we can't put a whole UInt32 in an Int
private let maxNIOFrameSize = Int(UInt32.max / 2)
#else
private let maxNIOFrameSize = Int(UInt32.max)
// on 64-bit platforms this works just fine
private let maxNIOFrameSize = Int(UInt32.max)
#endif
/// An inbound `ChannelHandler` that serializes structured websocket frames into a byte stream