Added DTSC keep alive for idle connections

This commit is contained in:
Thulinma 2016-09-02 17:50:52 +02:00
parent d50404a00c
commit a93fddf4e2
2 changed files with 4 additions and 1 deletions

View file

@ -100,6 +100,7 @@ namespace Mist {
std::string toRec = srcConn.Received().copy(8); std::string toRec = srcConn.Received().copy(8);
unsigned long rSize = Bit::btohl(toRec.c_str() + 4); unsigned long rSize = Bit::btohl(toRec.c_str() + 4);
if (!srcConn.Received().available(8 + rSize)) { if (!srcConn.Received().available(8 + rSize)) {
nProxy.userClient.keepAlive();
Util::sleep(100); Util::sleep(100);
continue; //abort - not enough data yet continue; //abort - not enough data yet
} }
@ -121,6 +122,7 @@ namespace Mist {
} }
}else{ }else{
Util::sleep(100); Util::sleep(100);
nProxy.userClient.keepAlive();
} }
} }
} }
@ -218,6 +220,7 @@ namespace Mist {
if (!needsLock()){ if (!needsLock()){
thisPacket.reInit(srcConn); thisPacket.reInit(srcConn);
if (thisPacket.getVersion() == DTSC::DTCM){ if (thisPacket.getVersion() == DTSC::DTCM){
nProxy.userClient.keepAlive();
std::string cmd; std::string cmd;
thisPacket.getString("cmd", cmd); thisPacket.getString("cmd", cmd);
if (cmd == "reset"){ if (cmd == "reset"){

View file

@ -42,7 +42,7 @@ namespace Mist {
static JSON::Value capa; static JSON::Value capa;
//non-virtual generic functions //non-virtual generic functions
int run(); int run();
void stats(bool force = false); virtual void stats(bool force = false);
void seek(unsigned long long pos); void seek(unsigned long long pos);
bool seek(unsigned int tid, unsigned long long pos, bool getNextKey = false); bool seek(unsigned int tid, unsigned long long pos, bool getNextKey = false);
void stop(); void stop();