swift-nio-transport-services/Sources
George Barnett 8ab824b140
Explicitly retain timer source when scheduling tasks (#138)
Motivation:

When a task is scheduled using a `DispatchTimerSource` on a `NIOTSEventLoop`
the source is retain via a callback on the promise associated with the
scheduled task. This stops the source from deinit'd before the task is
run. However, the callback being added is an implementation details of
`Scheduled` and the retain cycle is incidental.

If that detail chnaged (such as in
https://github.com/apple/swift-nio/pull/2011) then tasks may not run and
the promise could be leaked.

Modifications:

- Explicitly add a retain cycle between the future and the timer source
  which is broken by the promise being completed and callbacks run.

Result:

The timer source is kept alive until the event fires.
2022-01-12 10:37:50 +00:00
..
NIOTSHTTPClient Clean up imports and dependencies. (#130) 2021-09-14 10:06:42 +01:00
NIOTSHTTPServer Clean up imports and dependencies. (#130) 2021-09-14 10:06:42 +01:00
NIOTransportServices Explicitly retain timer source when scheduling tasks (#138) 2022-01-12 10:37:50 +00:00