mirror of
https://github.com/apple/swift-nio.git
synced 2026-05-20 20:30:36 +00:00
### Motivation: `NIOAsyncTestingChannel` stored its `localAddress` and `remoteAddress` in a locked storage on itself for thread safety, however in doing so left us open to bugs because a handler grabbing the addresses of the context had no visibility of the values. ### Modifications: Reach into `EmbeddedChannelCore` for the addresses instead of storing them on the `NIOAsyncTestinghannel`. I also considered a delegate approach where the `EmbeddedChannelCore` could offload the responsibility for storing the values back to the `NIOAsyncTestingChannel` but it was complicated and of questionable value. ### Result: * The correct address values are seen no matter how they are obtained. * We probably take a performance hit locking the values in this way but this is testing code so probably not the end of the world.