[Live-devel] Groupsock handling in OnDemandServerMediaSubsession.cpp

David BERTRAND bidibulle at operamail.com
Thu Jun 15 03:36:16 PDT 2006


Ross,

I see your point. Anyway, let me another chance to convince you :

- Monitoring/debugging of LiveMedia based applications will only be possible on UDP ports and on non-Windows environments (windows doesn't support SO_REUSEPORT option)
- In the current code, you create the RTCP groupsock by specifying the desired port number (RTP+1). If this port is already used by another process, your RTCP handler could receive any type of undesired traffic

- I found a compromise that should make everybody happy :  The set of "setsockoption" could be done after the socket binding. It would avoid LiveMedia to open a socket which is already in use and enable debugging applicaction to inspect the LiveMedia's UDP sockets.

- If you agree the RTCP groupsock creation in OnDemandServerMediaSubsession.cpp will have to be followed by an error handling in case the bind() fails (getSourcePort() returns False in this case). The rest of my proposed algorithm to optimize trials could remain in my own code...

What's your feeling about that ?

David


  const int reuseFlag = 1;
  if (setsockopt(newSocket, SOL_SOCKET, SO_REUSEADDR,
		 (const char*)&reuseFlag, sizeof reuseFlag) < 0) {
    socketErr(env, "setsockopt(SO_REUSEADDR) error: ");
    closeSocket(newSocket);
    return -1;
  }
  
#if defined(__WIN32__) || defined(_WIN32)
  // Windoze doesn't handle SO_REUSEPORT or IP_MULTICAST_LOOP
#else
#ifdef SO_REUSEPORT
  if (setsockopt(newSocket, SOL_SOCKET, SO_REUSEPORT,
		 (const char*)&reuseFlag, sizeof reuseFlag) < 0) {
    socketErr(env, "setsockopt(SO_REUSEPORT) error: ");
    closeSocket(newSocket);
    return -1;
  }
#endif
  
#ifdef IP_MULTICAST_LOOP
  const u_int8_t loop = (u_int8_t)setLoopback;
  if (setsockopt(newSocket, IPPROTO_IP, IP_MULTICAST_LOOP,
		 (const char*)&loop, sizeof loop) < 0) {
    socketErr(env, "setsockopt(IP_MULTICAST_LOOP) error: ");
    closeSocket(newSocket);
    return -1;
  }
#endif
#endif
> ----- Original Message -----
> From: "Ross Finlayson" <finlayson at live555.com>
> To: "LIVE555 Streaming Media - development & use" <live-devel at ns.live555.com>
> Subject: Re: [Live-devel] Groupsock handling in OnDemandServerMediaSubsession.cpp
> Date: Wed, 14 Jun 2006 14:08:27 -0700
> 
> 
> 
> > So the question is, do you follow my analysis and agree with the issue ?
> 
> Yes, I agree that there's an issue - however, I don't agree with the
> proposed solution of not setting the SO_REUSE* options when creating
> sockets.  IMHO, all sockets should have those options
> set.  (Monitoring/debugging of network applications by other
> applications running on the same computer is easier if you know that
> all sockets will be readable.)
> 
> The solution to the problem you saw is to modify the code (that you
> quoted) to keep around 'groupsocks' for all trials, not just the most
> recent one - i.e., to change "rtpGroupsock_old" to be a list of
> pointers, rather than just a single pointer.  I don't have time right
> now to make this change, so feel free to propose a modification and
> send a patch to the list.
> 
> 
> 	Ross Finlayson
> 	Live Networks, Inc. (LIVE555.COM)
> 	<http://www.live555.com/>
> 
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel

>


-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 8 at http://www.opera.com

Powered by Outblaze



More information about the live-devel mailing list