noxxi / p5-net-sip

Net::SIP Perl Module
Other
15 stars 22 forks source link

Fix event loop timers when select() syscall is interrupted #62

Closed pali closed 2 years ago

pali commented 2 years ago

select() syscall is blocking call during which system time can change a lot. If eventloop is waiting in the select() syscall for scheduled timer with big timeout (e.g. 10 minutes) and syscall is interrupted then eventloop starts executing timers from the time of previous start of select() syscall. So if scheduled timer has timeout 10 minutes, select() is interrupted after 5 minutes then timer is called in the best case after 15 minutes.

Fix this issue by updating internal eventloop timestamp also when select() syscall is interrupted. So next select() syscall is called with updated timeout value which reflects waiting in the previous select() call.

Fixes https://github.com/noxxi/p5-net-sip/issues/58