[FFmpeg-devel] [PATCH] avio: Check for FF_NETERROR(EAGAIN) in retry_transfer_wrapper
Ronald S. Bultje
rsbultje
Tue Feb 22 18:43:53 CET 2011
Hi,
On Tue, Feb 22, 2011 at 8:42 AM, Martin Storsj? <martin at martin.st> wrote:
> On Tue, 22 Feb 2011, Martin Storsj? wrote:
>
>> On Tue, 22 Feb 2011, M?ns Rullg?rd wrote:
>>
>> > > diff --git a/libavformat/network.h b/libavformat/network.h
>> > > index d6aee93..c575975 100644
>> > > --- a/libavformat/network.h
>> > > +++ b/libavformat/network.h
>> > > @@ -27,9 +27,21 @@
>> > > ?#include <winsock2.h>
>> > > ?#include <ws2tcpip.h>
>> > >
>> > > -#define ff_neterrno() (-WSAGetLastError())
>> > > -#define FF_NETERROR(err) (-WSA##err)
>> > > -#define WSAEAGAIN WSAEWOULDBLOCK
>> > > +static inline int ff_neterrno() {
>> > > + ? ?int err = WSAGetLastError();
>> > > + ? ?switch (err) {
>> > > + ? ?case WSAEWOULDBLOCK:
>> > > + ? ? ? ?return AVERROR(EAGAIN);
>> > > + ? ?case WSAEINTR:
>> > > + ? ? ? ?return AVERROR(EINTR);
>> > > + ? ?}
>> > > + ? ?return -err;
>> > > +}
>> > > +
>> > > +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
>> > > +#define ETIMEDOUT WSAETIMEDOUT
>> > > +#define ECONNREFUSED WSAECONNREFUSED
>> > > +#define EINPROGRESS WSAEINPROGRESS
>> >
>> > Are we certain these are never defined on Windows, or should they have
>> > some ifdefs? ?Also, a little vertical alignment wouldn't hurt.
>>
>> I guess you never can be certain, but they don't exist in neither mingw32
>> nor in Visual Studio. (mingw64 seems to have them defined, mapping to the
>> WSAE* codes just as we do, but within #if 0.) If they later turn out to be
>> defined in some platform update, we can always add ifdefs around them and
>> add mapping in ff_neterrno() for them.
>>
>> Aligned them vertically at least, and moved them up above ff_neterrno(),
>> which would be needed if we later will have to remap them.
>
> And this time featuring the actual attachment...
Queued this version.
Ronald
More information about the ffmpeg-devel
mailing list