rawrtc / rawrtc-data-channel

A standalone WebRTC and ORTC data channel implementation.
BSD 2-Clause "Simplified" License
52 stars 6 forks source link

Handle SCTP events fairly #10

Open lgrahl opened 6 years ago

lgrahl commented 6 years ago

The SCTP socket is a virtual socket. Thus, fd_set cannot be used for it and it cannot be registered on the event loop itself. A normal file descriptor would only raise one event and then the other descriptors have a chance to raise events, too. The virtual SCTP socket is not being polled but calls a handler function to indicate that events should be handled. Currently, we read those events in a loop which leads to monopolisation of SCTP events in comparison to other file descriptors.

https://github.com/rawrtc/rawrtc/tree/fair-multiple-sctp-events is outdated but has a solution for this problem. However, there were some timing issues and the implementation in general lead to poor performance.