[vlc-devel] [PATCH] src/network: try to write data again if EAGAIN is returned

David Fuhrmann david.fuhrmann at gmail.com
Sat Dec 14 00:50:15 CET 2013

Am 13.12.2013 um 16:22 schrieb Denis Charmet <typx at dinauz.org>:

> Le vendredi 13 décembre 2013 à 03:26:16, David Fuhrmann a écrit :
>> AFAIK poll returns if some data can be sent. But what if you want to send more data than the write buffer has place for? Is it guaranteed that then write always returns the number of bytes written, but never EAGAIN?
> Well, it may be stupid but I'm kinda afraid that if poll returns
> then write set errno to EAGAIN, you may end up in an busyloop where
> poll always returns immediately but you cannot write for some reason.
> For me write should actually write as much as it can and return how much
> it wrote.

Thanks for the answer. I especially asked because of two reasons:

First, according to [1] there might be other reasons why write may return EAGAIN. As its stated that this is not really a fatal error, I was wondering if its better to also not handle this as a fatal error within VLC.
Second, the securetransport patch I just posted depends on this currently. For details, see the comment within the write callback. But maybe a better solution can be found for this.

Best regards,

[1] http://stackoverflow.com/questions/3070127/will-eagain-return-on-send-for-anything-other-than-buffer-full

More information about the vlc-devel mailing list