[Live-devel] Infinite loop in liveMedia/MediaSession.cpp with Windows CE
Denis Charmet
dcharmet at uniways.fr
Mon May 11 06:52:43 PDT 2009
Ross Finlayson wrote:
>> I agree that WinCE should not be doing that. However, IMHO, requesting
>> a port over and over, assuming that the OS will eventually give you
>> something suitable, is a risky behavior
>
> There's really no alternative. We can't just arbitrarily choose an
> even number ourselves, in case we get a port number that happens to be
> used by someone else. And we also have to make sure that - if the
> code is run in more than one process (i.e., application) on the same
> host - we don't end up with more than one process accidentally using
> the same port number.
>
>
>> So I think that it would be appropriate for live555 code to implement
>> some measures making sure that this doesn't happen, and while we're at
>> it, possibly working around OS bugs.
>
> No, in general we're not going to "work around OS bugs" - especially
> ones as aggregious as this. What I will do, however, is change the
> code - where it "Add()"s a record for a port number to the hash table
> - to check whether there was already a hash table entry (for the same
> port number) there - so at least we don't end up with a memory leak in
> this situation.
There is also the 'failure' memory leak:
if (!success) break; // a fatal error occurred trying to create the RTP
and RTCP sockets; we can't continue (liveMedia/MediaSession.cpp : 685)
which IMHO could become:
if (!success) {
Groupsock* oldGS;
while ((oldGS = (Groupsock*)socketHashTable->RemoveNext()) != NULL) {
delete oldGS;
}
delete socketHashTable;
break; // a fatal error occurred trying to create the RTP and RTCP
sockets; we can't continue
}
By the way Microsoft's excuse for that is that getsockname can return
false informations before the socket is connected as devices can be
multihomed.
http://msdn.microsoft.com/en-us/library/ms738543(VS.85).aspx
Thanks for the answers.
Best regards.
--
Denis Charmet
More information about the live-devel
mailing list