[Live-devel] BasicTaskScheduler is not handling err 10038
Ken Seo
ken.seo at gmail.com
Mon May 5 07:33:28 PDT 2008
Hi Ross,
So, here is what I found, "WSAGetLastError()" returns WSAENOTSOCK when
turnOffBackgroundReadHandling was not called as many times as
turnOnBackgroundReadHandling is called.
So, my problem was happening only on RTP over TCP, as
turnOnBackgroundReadHandling is called
twice for RTCP handling and turnOffBackgroundReadHandling was called only
once when clientsession is deleted.
in OnDemandMediaSubsession.cpp, startPlaying method (line 425),
RTCPInstance::createNew(..) will call turnOnBackgroundReadHandling as a part
of RTCPInstance construction.
and then, if it's RTCP over TCP, addStreamSocket is called, which will call
turnOnBackgroundReadHandling again (for the same socket)
if (dests->isTCP) {
.. fRTCPInstance->addStreamSocket(..)
in RTCP.cpp
void RTCPInstance::addStreamSocket(int sockNum,
unsigned char streamChannelId) {
// Add the RTCP-over-TCP interface:
fRTCPInterface.setStreamSocket(sockNum, streamChannelId);
// Turn on background reading for this socket (in case it's not on
already):
TaskScheduler::BackgroundHandlerProc* handler
= (TaskScheduler::BackgroundHandlerProc*)&incomingReportHandler;
fRTCPInterface.startNetworkReading(handler);
}
So, my quickest fix was to put the following line
void RTCPInstance::addStreamSocket(int sockNum,
unsigned char streamChannelId)
{
* // Turn off the default background read handling created along with
RTCPInstance
fRTCPInterface.stopNetworkReading();
*
// Add the RTCP-over-TCP interface:
fRTCPInterface.setStreamSocket(sockNum, streamChannelId);
// Turn on background reading for this socket
TaskScheduler::BackgroundHandlerProc* handler
= (TaskScheduler::BackgroundHandlerProc*)&incomingReportHandler;
fRTCPInterface.startNetworkReading(handler);
}
I'm not 100% sure why you have to call "turnOnBackgroundReadHandling" twice
for RTP over TCP, but it seems like "turnOnBackgroundReadHandling" should be
called after "fRTCPInterface.setStreamSocket(sockNum, streamChannelId)" to
handle RTCP over TCP correctly.
--> Also I was just wondering, isn't fRTCPInterface supposed to be
fRTPInterface, since it is actually an instance of RTPInterface,
I know that I don't fully understand live555 code at the moment, so, if what
I explained above does not make any sense to you then please let me know,
Best Regards,
Ken Seo
On Wed, Apr 30, 2008 at 9:01 PM, Ross Finlayson <finlayson at live555.com>
wrote:
> >Windows error 10038 is "WSAENOTSOCK", and typically happens when an
> >application is trying to do some socket operation on non-socket or the
> >socket that has already been closed, (at least that's my
> >understanding..)
> >I was getting this error, from the line in the BasicTaskScheduler.cpp
> >(build 2008-04-03)
> >
> > int err = WSAGetLastError(); // err = 10038
> >
> >And it only happens when RTSP server tries to delete clientSession due
> >to livenessTimeout, (it doesn't happen when session gets closed by
> >TEARDOWN request).
>
> That's odd, because - in each case - the "RTSPClientSession"
> destructor will get called, and this should be removing its socket
> from the set of active sockets, via the call to
>
envir().taskScheduler().turnOffBackgroundReadHandling(fClientSocket);
> on line 271 of "RTSPServer.cpp".
>
> So I wonder why this isn't working for you.
>
> Please let us know if you can find out anything more about this issue.
> --
>
>
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20080505/5cfc746b/attachment.html>
More information about the live-devel
mailing list