Tags: planetary-social/swift-nio
Tags
Better handle writability changes in triggerWriteOperations (apple#1624) Motivation: If a write is buffered in the `PendingWritesManager` and the high watermark is breached then a writability change will be fired as a result. The corresponding event when the channel becomes writable again comes when enough pending bytes have been written to the socket (i.e. as a result of a `flush()`) and we fall below the low watermark. However, if a promise associated with a write has a callback registered on its future which writes enough data to breach the high watermark (and also flushes) then we will re-entrantly enter `flushNow()`. This is okay, `flushNow()` protects against re-entrancy and any re-entrantly enqueud flushed writes will be picked up in the write-spin-loop. The issue here is that the `writeSpinLoop` does not monitor for changes in writability. Instead if checks the writability before it begins and after it completes, only signalling if there was a change. This is problematic: the re-entrant write-and-flush could have caused the channel to become unwritable yet no event will be fired to make it writable again! Modifications: - Store a local writability state in the pending writes manager and modify it when we emit writability changes Result: - Better protection against re-entrant writability changes.
Linux: make `Epoll` available on Android (apple#1621) Android is sufficiently Linux-esque that it should be able to use `Epoll`.
Avoid including non-modular headers. (apple#1605) Motivation: We included netinet/ip.h in CNIODarwin, which unfortunately is not modularised. This causes issues when using SwiftPM to create xcodeproj files. There's no real reason to do it this way, when we can just as easily abstract the issue. Modifications: - Moved netinet/ip.h to the .c file instead of the .h. - Defined some exported namespaced integers to correspond to the macros. - Performed platform abstraction in Posix instead of everywhere. Result: - Creating xcodeproj files should be fine.
Don't use deadbeef for dead pointers. (apple#1604) Motivation: It turns out using this overflows Int on "Any iOS Device" Modifications: Switch the first d to a 7. Result: Code will compile on "Any iOS Device".
Don't install Jazzy on Xenial (apple#1597) Motivation: Ruby on Xenial is too old for the cocoapods downloader which jazzy uses. Modifications: Change Dockerfile to not install Jazzy on xenial. Result: Dockerfile will build again, but bionic or later is required for docs.
Make UDP connection allocation test more like best practice code. (ap… …ple#1583) Motivation: There is at least a theoretical race to flush before close in prior version. Having terrible code in the NIO repo is asking for someone to copy it. Modifications: flatMap the various parts of the client together which also ensures the flush is complete before close is called. Result: Slightly nicer code, slightly fewer allocations.
Allocation diffing script no longer drops data. (apple#1513) Allocation diffing script no longer drops data. Motivation: Looking at allocations is hard enough without the script getting the allocation counts wrong. Modifications: Where multiple allocations resolved to the same "key" only the last allocation was accounted for. I have changed the script to store all allocations - still keyed in the same way. When diffing the total number of allocations is used - if they are different the total and all contributing stack traces are output. Added a total for all allocations everywhere at the end together with a difference number. Output all stack traces before and after contributing to a detected diff. Update the documentation to reflect changes. Change the threshold for reporting diffs from > 1000 to >= 1000. This means if allocations go from 1000 to 2000 they are reported as a difference rather than a new allocation. Result: It is now easier - if somewhat more verbose to compare allocations.
bootstraps: offer ELG validation (apple#1464) Motivation: Today, we just expect the ELGs passed to the bootstraps to be the correct ones, if not, we crash. Modifications: Offer an alternative `validatingGroup:` `init` that just returns `nil` if the ELGs are of the wrong types. Result: Easier to work with multi-stack systems for example when the user might pass an ELG for either NIO on Sockets or NIO on Network.framework.
PreviousNext