This PR fixes the hang in case of network interruption during getUpdates.
Steps to reproduce: unplug/replug the network cable or disconnect/reconnect to wifi, while the program is in getUpdates call, which is almost 100% of the time usually.
The hang happens because on the lowest level epoll doesn't notify us of network interruption (unless tcp keepalive is enabled), and such socket will never produce any read event after the interruption.
The fix is to introduce a timeout over http request. Conveniently we already have the timeout notion on the protocol level, so we reuse this value (only adding 10 seconds to it just in case).
This PR fixes the hang in case of network interruption during
getUpdates
.Steps to reproduce: unplug/replug the network cable or disconnect/reconnect to wifi, while the program is in
getUpdates
call, which is almost 100% of the time usually.The hang happens because on the lowest level
epoll
doesn't notify us of network interruption (unless tcp keepalive is enabled), and such socket will never produce anyread
event after the interruption.The fix is to introduce a timeout over http request. Conveniently we already have the timeout notion on the protocol level, so we reuse this value (only adding 10 seconds to it just in case).