Temporary fix for live buffers - will be superseded by upcoming architecture changes.
This commit is contained in:
parent
13adf0bed0
commit
afcddbfca6
3 changed files with 14 additions and 1 deletions
|
@ -152,7 +152,7 @@ namespace Buffer {
|
|||
}
|
||||
}else{
|
||||
//complete a send
|
||||
Stream::get()->getPacket(usr->myRing->b).sendTo(usr->S);
|
||||
Stream::get()->sendPacket(usr->myRing->b, usr->S);
|
||||
if ( !usr->S.connected()){break;}
|
||||
//switch to next buffer
|
||||
if (Stream::get()->isNewest(usr->myRing->b, allowedTracks)){
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "buffer_stream.h"
|
||||
#include <mist/timing.h>
|
||||
#include <mist/defines.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace Buffer {
|
||||
|
@ -172,6 +173,16 @@ namespace Buffer {
|
|||
name = n;
|
||||
}
|
||||
|
||||
void Stream::sendPacket(DTSC::livePos & num, Socket::Connection & S){
|
||||
rw_mutex.lock();
|
||||
if (!getPacket(num) && buffers.size()){
|
||||
DEBUG_MSG(DLVL_DEVEL, "Oh noes, ran out of packets! Resetting to beginning...");
|
||||
num = buffers.rbegin()->first;
|
||||
}
|
||||
getPacket(num).sendTo(S);
|
||||
rw_mutex.unlock();
|
||||
}
|
||||
|
||||
/// parsePacket override that will lock the rw_mutex during parsing.
|
||||
bool Stream::parsePacket(std::string & buffer){
|
||||
rw_mutex.lock();
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace Buffer {
|
|||
bool setInput(Socket::Connection S);
|
||||
/// Gets the current socket for push data.
|
||||
Socket::Connection & getIPInput();
|
||||
/// Send a packet while locking the mutex.
|
||||
void sendPacket(DTSC::livePos & num, Socket::Connection & S);
|
||||
/// Stores intermediate statistics.
|
||||
void saveStats(std::string username, Stats & stats);
|
||||
/// Stores final statistics.
|
||||
|
|
Loading…
Add table
Reference in a new issue