]> git.vomp.tv Git - vompserver.git/commitdiff
Fix for server thread hang if no data available on getblock
authorChris Tallon <chris@vomp.tv>
Wed, 3 Aug 2005 18:42:12 +0000 (18:42 +0000)
committerChris Tallon <chris@vomp.tv>
Wed, 3 Aug 2005 18:42:12 +0000 (18:42 +0000)
transceiver.c

index 46a2f23fa7315012a2d67e354bf86c77f561a7ce..4ff34abad9759e08c84ed05343f244c6858b29aa 100644 (file)
@@ -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);
   }