[Udpcast] Bug: Receiver thread may not

vivek vedagiri vvivek_4881 at yahoo.com
Thu Jul 29 08:46:08 CEST 2004


When using FEC, the receiver might not terminate
because it might enter a blocking read when it

Line 874 of receivedata.c (release date 31052004) is:
ret=recvmsg(fd, &clst->data_hdr, 0);

Ideally, this line shouldn't be reached when
clst->endReached is 2. But since the value is set by a
different thread, it might reach the recvmsg() call if
clst->endReached was set to 2 after the while loop (on
line 845) is executed. In that case, the udp-receiver
does not terminate since the thread is blocked by the
recvmsg() call, although the file has been
successfully received.

One way to work around this is to replace the
recvmsg() call with a non-blocking version, as
while (1)
    ret=recvmsg(fd, &clst->data_hdr, MSG_DONTWAIT);
    if (ret < 0)
        if (errno == EAGAIN)
// execute the same code as in the while loop
        } else break;
    } else break;


Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.

More information about the Udpcast mailing list