From a6764b2a4382a1f658413d5a43784f006b883c6a Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 25 Nov 2007 13:25:36 +0000 Subject: [PATCH] Bug fix for new stream protocol --- mvpreceiver.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/mvpreceiver.c b/mvpreceiver.c index fcc9caf..ae8c01b 100755 --- a/mvpreceiver.c +++ b/mvpreceiver.c @@ -102,14 +102,17 @@ void MVPReceiver::threadMethod() threadWaitForSignal(); threadCheckExit(); - pthread_mutex_lock(&processedRingLock); - amountReceived = processed.get(buffer+12, streamChunkSize); - pthread_mutex_unlock(&processedRingLock); + do + { + pthread_mutex_lock(&processedRingLock); + amountReceived = processed.get(buffer+12, streamChunkSize); + pthread_mutex_unlock(&processedRingLock); - *(ULONG*)&buffer[0] = htonl(2); // stream channel - *(ULONG*)&buffer[4] = htonl(streamID); - *(ULONG*)&buffer[8] = htonl(amountReceived); - tcp->sendPacket(buffer, amountReceived + 12); + *(ULONG*)&buffer[0] = htonl(2); // stream channel + *(ULONG*)&buffer[4] = htonl(streamID); + *(ULONG*)&buffer[8] = htonl(amountReceived); + tcp->sendPacket(buffer, amountReceived + 12); + } while(processed.getContent()); } } -- 2.39.5