10 Sep
2019
10 Sep
'19
1:53 a.m.
On 9/09/2019 22:59, Stephan Menzel wrote:
Well, I got both implementations (async timed connect and socks4 handshake in place now and I do prefer the coroutine approach as it is much easier to read and I wanted to adapt this to more functions very soon.
FWIW, your timeout handler if-check is somewhat redundant. You're capturing the expiry by value (as you have to -- you can't capture it by reference since you're moving the lifetime of the timer), which means that it will always be less than the current time, unless the timer was aborted early due to some error other than operation_aborted. There isn't any code that can change the expiration time seen by the lambda callback (which the comment expresses as the reason for the check).