[Udpcast] Bug: Receiver thread may not

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


Hi,

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

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
follows:
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
discussed 
        } else break;
    } else break;
}

Regards,
Vivek


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 



More information about the Udpcast mailing list