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

Rémi Denis-Courmont remi at remlab.net
Sat Dec 14 01:04:23 CET 2013


On Sat, 14 Dec 2013 00:50:15 +0100, David Fuhrmann
<david.fuhrmann at gmail.com> wrote:
> First, according to [1] there might be other reasons why write may
return
> EAGAIN.

Since when is stackoverflow.com a reliable source of informations? The
specification for POSIX is on opengroup.org. The error codes for
out-of-memory are ENOMEM or ENOBUFS. And they are non-recoverable error
since they is generally no way to know when the error condition is
resolved. Besides, it is not a legal transition for a TCP socket to ever
*reduce* its available send buffer space. (It could be possible for some
poorly designed network protocols, but not TCP.)

> As its stated that this is not really a fatal error,

EINTR is edge-triggered, but EGAIN is level-triggered. Denis' point is
that skipping EGAIN would result in a live loop, even if it is not a fatal
error for the TCP state machine.

> I was wondering if its better to also not handle this as a fatal error
> within VLC.

You cannot recover from it, short of doing a live loop. Live loops are
unacceptable, especially on battery-powered devices. Hence this is best
treated as a fatal error.

-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list