Haivision / srtgo

Go bindings for SRT. Advantages of SRT technology for an easy to use programming language
Mozilla Public License 2.0
185 stars 52 forks source link

check and handle epoll-errors, use direction-specific epoll-handles #32

Closed iSchluff closed 3 years ago

iSchluff commented 3 years ago

The current epoll_wait calls never check for error and also we currently always subscribe to in and out which almost certainly breaks epoll for bidirectional sockets.

This patch replaces the epoll_wait calls with epoll_uwait and always checks the events for error. It also changes the epoll ids to be separate for input/output and just waits on the relevant id for each operation.

The only small api-behaviour change is that now non-blocking operations return an error on timeout instead of nil. This can be used to distinguish timeout from success. The timeout error implements Timeout() and Temporary() The change will almost certainly break nothing because previously non-blocking wasn't working anyway and with a default timeout of -1 the timeout has to be set explicitely.