[Live-devel] BasicTaskScheduler is not handling err 10038
Ken Seo
ken.seo at gmail.com
Wed Apr 30 08:46:50 PDT 2008
Hi,
I'm developing a RTSP server based on live555 and I've noticed that
BasicTaskScheduler is not handling the windows error 10038,
Here is the case when it gets the error 10038, say, the RTSP server is
running and a client request a movie and start playing. If the client
process dies without sending TEARDOWN, the server will eventually get
the error from the following code segment and terminate itself.
// In BasicTaskScheduler
int selectResult = select(fMaxNumSockets, &readSet, NULL, NULL,
&tv_timeToDelay);
if (selectResult < 0) {
#if defined(__WIN32__) || defined(_WIN32)
int err = WSAGetLastError();
printf("err: %d", err);
// For some unknown reason, select() in Windoze sometimes fails
with WSAEINVAL if
// it was called with no entries set in "readSet". If this
happens, ignore it:
if (err == WSAEINVAL && readSet.fd_count == 0) {
err = 0;
// To stop this from happening again, create a dummy readable socket:
int dummySocketNum = socket(AF_INET, SOCK_DGRAM, 0);
FD_SET((unsigned)dummySocketNum, &fReadSet);
}
if (err != 0) {
#else
if (errno != EINTR && errno != EAGAIN) {
#endif
// Unexpected error - treat this as fatal:
#if !defined(_WIN32_WCE)
perror("BasicTaskScheduler::SingleStep(): select() fails");
#endif
exit(0);
}
In my mind, the server termination should not happen just because of a
single client failure, Is there any way I can manually flush the
socket when I get the error 10038 instead of terminating the server?
Best Regards,
Ken Seo
More information about the live-devel
mailing list