From: Chris Tallon Date: Wed, 3 Aug 2005 18:42:12 +0000 (+0000) Subject: Fix for server thread hang if no data available on getblock X-Git-Tag: r0-0-17~14 X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=b86644799c0fb10be2568ed1647b7a5d43441a40;p=vompserver.git Fix for server thread hang if no data available on getblock --- diff --git a/transceiver.c b/transceiver.c index 46a2f23..4ff34ab 100644 --- a/transceiver.c +++ b/transceiver.c @@ -1,6 +1,8 @@ /* Edited for VOMP by Chris Tallon Edits Copyright 2004-2005 Chris Tallon + + This class will be replaced soon. */ /* @@ -223,9 +225,16 @@ unsigned long cMediamvpTransceiver::getBlock(unsigned char* buffer, unsigned lon { pthread_mutex_lock(&ringLock); + int numTries = 0; + while ((unsigned long)rb.getContent() < amount) { pthread_mutex_unlock(&ringLock); + if (++numTries == 10) // 5s + { + log->log("Transciever", Log::DEBUG, "getBlock timeout"); + return 0; + } usleep(500000); pthread_mutex_lock(&ringLock); }