chadnickbok / librtcdcpp

A simple WebRTC DataChannels library
BSD 3-Clause "New" or "Revised" License
158 stars 41 forks source link

SCTP send buffer not being flushed? #28

Closed mo3rfan closed 7 years ago

mo3rfan commented 7 years ago

When I try to send a few bytes worth of strings separately, which would collectively amount to 256kB, it would stall the connection and I'm unable to send anymore. The error I get is EAGAIN/EWOULDBLOCK with the error message as "Resource temporarily unavailable".

This is obviously filling up the usrsctp send buffer (which is around 256kB). I'm not sure why it's not being flushed considering that the receiving side does receive all the bytes upto 256kB. Even when I place generous amounts of sleep between each send, the buffer doesn't clear on its own.

This is only an issue when I try to send from the C/C++ program to the browser.

mo3rfan commented 7 years ago

This turned out to be an implementation issue. I was blocking the "onDataChannel" callback thread by doing a join() for the sending thread that started inside it, instead of a detach().

chadnickbok commented 7 years ago

Thanks for the update, glad to hear this issue has been resolved.