[Udpcast] patch submit: Provide a watchdog on receiver

Julien Aube julien.aube at openwide.fr
Mon Sep 13 11:59:11 CEST 2010


I've made the attached patch to prevent the situation where the udp-receiver
hang out indefinitly waiting for data when the server has been killed after
having started to send data.

In this case, the udp-received program would hang indefinitly.

Since in my program, udp-receiver is called through system(...); the result is
a hang.

With this patch I use a SIGALARM signal to reset a flag to 0, and act as a
watchdog. The watchdog is started just before the sending data phase of the
protocol, and is feed each time a packet is received from the server.

If 2 times in a row the watchdog is not feed, the program exit in error.

The current value is set as a #define as 60s, which is in effect 2mn before
udp-receiver is actually killed.

However I am aware that this implementation is somehow crude, and I would be
interested by any other way to do that.

Additionally, if someone is interested by this patch, I could make it so that
the watchdog period is configurable on the command-line.

Thanks for your time,

People in the embedded space don't do prototypes. They hack something until it
works, then it's done.
Always code as if the person who will maintain your code is a maniac serial
killer that knows where you live
-------------- next part --------------
A non-text attachment was scrubbed...
Name: udpcast_add_receiver_watchdog.patch
Type: text/x-diff
Size: 2466 bytes
Desc: not available
URL: <http://www.udpcast.linux.lu/pipermail/udpcast/attachments/20100913/02bc7b24/attachment.patch>

More information about the Udpcast mailing list