[FFmpeg-devel] [PATCH] Enable proper IPv6 functions on windows

Ramiro Polla ramiro.polla
Mon Jan 25 02:30:20 CET 2010


On Fri, Jan 22, 2010 at 8:49 PM, Martin Storsj? <martin at martin.st> wrote:
> On Fri, 22 Jan 2010, Reimar D?ffinger wrote:
>> On Fri, Jan 22, 2010 at 10:50:03AM -0500, Ronald S. Bultje wrote:
>> > On Fri, Jan 22, 2010 at 10:40 AM, Martin Storsj? <martin at martin.st> wrote:
>> > > On Fri, 22 Jan 2010, Ronald S. Bultje wrote:
>> > >> > + ? ?int (WSAAPI *win_getnameinfo)(const struct sockaddr *sa, socklen_t salen,
>> > >> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?char *host, DWORD hostlen,
>> > >> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?char *serv, DWORD servlen, int flags);
>> > >> > + ? ?HMODULE ws2mod = GetModuleHandle("ws2_32.dll");
>> > >> > + ? ?win_getnameinfo = GetProcAddress(ws2mod, "getnameinfo");
>> > >> > + ? ?if (win_getnameinfo)
>> > >> > + ? ? ? ?return win_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
>> > >>
>> > >> Sorry, I didn't follow the discussion very much...
>> > >>
>> > >> Shouldn't the function pointer variable (in all functions) not be
>> > >> static? Now you load it every time which sounds like a huge
>> > >> time-waster to me. Otherwise looks ok to me.
>> > >
>> > > I guess that would be ok, too. Theoretically, it wouldn't be totally
>> > > thread safe, but for all practical matters I think it would be ok.
>> >
>> > How would it not be threadsafe? In the worst case, we store the (same)
>> > function pointer address in that variable twice (or, oh no!!!, even 3
>> > times). However, the value should never be invalid unless the compiler
>> > is on drugs and clears the variable before storing the actual address
>> > in it.
>
> Yeah, true, I guess I can't really come up with a really proper
> explanation on when it would go wrong unless the compiler is totally
> insane.
>
>> You never know what it might do :-).
>> But seriously, I don't see much of a point (unless with further changes),
>> because
>> a) I doubt the performance if getnameinfo matters in any way, at least on that scale.
>> b) The non-complex way to do it would only avoid the overhead if getnameinfo etc. are available.
>
> I don't really have that much an opinion here - this way the
> winsock-specific kludge is as small as possible, but if you Ronald prefer
> a version with static pointers, I can cook up such a patch instead...

No one was furiously against the patches, and no progress was being
made, so applied.



More information about the ffmpeg-devel mailing list