Merge branch 'development' into LTS_development
This commit is contained in:
commit
c867ea6d26
9 changed files with 105 additions and 39 deletions
|
@ -36,6 +36,13 @@ namespace Mist{
|
|||
capa["optional"]["debug"]["help"] = "The debug level at which messages need to be printed.";
|
||||
capa["optional"]["debug"]["option"] = "--debug";
|
||||
capa["optional"]["debug"]["type"] = "debug";
|
||||
|
||||
JSON::Value option;
|
||||
option["long"] = "noinput";
|
||||
option["short"] = "N";
|
||||
option["help"] = "Do not start input if not already started";
|
||||
option["value"].append(0ll);
|
||||
cfg->addOption("noinput", option);
|
||||
}
|
||||
|
||||
Output::Output(Socket::Connection & conn) : myConn(conn){
|
||||
|
@ -51,6 +58,7 @@ namespace Mist{
|
|||
maxSkipAhead = 7500;
|
||||
minSkipAhead = 5000;
|
||||
realTime = 1000;
|
||||
lastRecv = Util::epoch();
|
||||
if (myConn){
|
||||
setBlocking(true);
|
||||
}else{
|
||||
|
@ -288,10 +296,19 @@ namespace Mist{
|
|||
/// Finally, calls updateMeta()
|
||||
void Output::reconnect(){
|
||||
thisPacket.null();
|
||||
if (!Util::startInput(streamName)){
|
||||
FAIL_MSG("Opening stream %s failed - aborting initialization", streamName.c_str());
|
||||
onFail();
|
||||
return;
|
||||
if (config->hasOption("noinput") && config->getBool("noinput")){
|
||||
Util::sanitizeName(streamName);
|
||||
if (!Util::streamAlive(streamName)){
|
||||
FAIL_MSG("Stream %s not already active - aborting initialization", streamName.c_str());
|
||||
onFail();
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
if (!Util::startInput(streamName)){
|
||||
FAIL_MSG("Opening stream %s failed - aborting initialization", streamName.c_str());
|
||||
onFail();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (statsPage.getData()){
|
||||
statsPage.finish();
|
||||
|
@ -788,11 +805,17 @@ namespace Mist{
|
|||
static bool firstData = true;//only the first time, we call onRequest if there's data buffered already.
|
||||
if ((firstData && myConn.Received().size()) || myConn.spool()){
|
||||
firstData = false;
|
||||
DEBUG_MSG(DLVL_DONTEVEN, "onRequest");
|
||||
DONTEVEN_MSG("onRequest");
|
||||
onRequest();
|
||||
lastRecv = Util::epoch();
|
||||
}else{
|
||||
if (!isBlocking && !parseData){
|
||||
Util::sleep(500);
|
||||
if (Util::epoch() - lastRecv > 300){
|
||||
WARN_MSG("Disconnecting 5 minute idle connection");
|
||||
myConn.close();
|
||||
}else{
|
||||
Util::sleep(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ namespace Mist {
|
|||
std::map<unsigned long, unsigned long> nxtKeyNum;///< Contains the number of the next key, for page seeking purposes.
|
||||
std::set<sortedPageInfo> buffer;///< A sorted list of next-to-be-loaded packets.
|
||||
bool sought;///<If a seek has been done, this is set to true. Used for seeking on prepareNext().
|
||||
uint64_t lastRecv;
|
||||
protected://these are to be messed with by child classes
|
||||
virtual std::string getConnectedHost();
|
||||
virtual std::string getConnectedBinHost();
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Mist {
|
|||
}
|
||||
|
||||
bool OutJSON::onFinish(){
|
||||
if (!jsonp.size()){
|
||||
if (!jsonp.size() && !first){
|
||||
myConn.SendNow("]);\n\n", 5);
|
||||
}
|
||||
myConn.close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue