Completed new sessions system
Co-authored-by: Thulinma <jaron@vietors.com>
This commit is contained in:
parent
074e757028
commit
8ac486b815
36 changed files with 991 additions and 620 deletions
|
@ -502,6 +502,7 @@ namespace Mist{
|
|||
}
|
||||
|
||||
int Input::run(){
|
||||
Comms::sessionConfigCache();
|
||||
if (streamStatus){streamStatus.mapped[0] = STRMSTAT_BOOT;}
|
||||
checkHeaderTimes(config->getString("input"));
|
||||
if (needHeader()){
|
||||
|
@ -623,6 +624,8 @@ namespace Mist{
|
|||
/// ~~~~~~~~~~~~~~~
|
||||
void Input::serve(){
|
||||
users.reload(streamName, true);
|
||||
Comms::Connections statComm;
|
||||
uint64_t startTime = Util::bootSecs();
|
||||
|
||||
if (!M){
|
||||
// Initialize meta page
|
||||
|
@ -636,6 +639,7 @@ namespace Mist{
|
|||
meta.setSource(config->getString("input"));
|
||||
|
||||
bool internalOnly = (config->getString("input").find("INTERNAL_ONLY") != std::string::npos);
|
||||
bool isBuffer = (capa["name"].asStringRef() == "Buffer");
|
||||
|
||||
/*LTS-START*/
|
||||
if (Triggers::shouldTrigger("STREAM_READY", config->getString("streamname"))){
|
||||
|
@ -666,6 +670,18 @@ namespace Mist{
|
|||
}else{
|
||||
if (connectedUsers && M.getValidTracks().size()){activityCounter = Util::bootSecs();}
|
||||
}
|
||||
// Connect to stats for INPUT detection
|
||||
if (!internalOnly && !isBuffer){
|
||||
if (!statComm){statComm.reload(streamName, getConnectedBinHost(), JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "");}
|
||||
if (statComm){
|
||||
uint64_t now = Util::bootSecs();
|
||||
statComm.setNow(now);
|
||||
statComm.setStream(streamName);
|
||||
statComm.setTime(now - startTime);
|
||||
statComm.setLastSecond(0);
|
||||
connStats(statComm);
|
||||
}
|
||||
}
|
||||
// if not shutting down, wait 1 second before looping
|
||||
if (config->is_active){Util::wait(INPUT_USER_INTERVAL);}
|
||||
}
|
||||
|
@ -820,7 +836,7 @@ namespace Mist{
|
|||
|
||||
if (Util::bootSecs() - statTimer > 1){
|
||||
// Connect to stats for INPUT detection
|
||||
if (!statComm){statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);}
|
||||
if (!statComm){statComm.reload(streamName, getConnectedBinHost(), JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "");}
|
||||
if (statComm){
|
||||
if (!statComm){
|
||||
config->is_active = false;
|
||||
|
@ -830,7 +846,6 @@ namespace Mist{
|
|||
uint64_t now = Util::bootSecs();
|
||||
statComm.setNow(now);
|
||||
statComm.setStream(streamName);
|
||||
statComm.setConnector("INPUT:" + capa["name"].asStringRef());
|
||||
statComm.setTime(now - startTime);
|
||||
statComm.setLastSecond(0);
|
||||
connStats(statComm);
|
||||
|
@ -984,7 +999,7 @@ namespace Mist{
|
|||
|
||||
if (Util::bootSecs() - statTimer > 1){
|
||||
// Connect to stats for INPUT detection
|
||||
if (!statComm){statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);}
|
||||
if (!statComm){statComm.reload(streamName, getConnectedBinHost(), JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "");}
|
||||
if (statComm){
|
||||
if (statComm.getStatus() & COMM_STATUS_REQDISCONNECT){
|
||||
config->is_active = false;
|
||||
|
|
|
@ -210,7 +210,7 @@ namespace Mist{
|
|||
if (lastSecs != currSecs){
|
||||
lastSecs = currSecs;
|
||||
// Connect to stats for INPUT detection
|
||||
statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);
|
||||
statComm.reload(streamName, getConnectedBinHost(), JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "");
|
||||
if (statComm){
|
||||
if (statComm.getStatus() & COMM_STATUS_REQDISCONNECT){
|
||||
config->is_active = false;
|
||||
|
@ -225,7 +225,6 @@ namespace Mist{
|
|||
statComm.setDown(tcpCon.dataDown());
|
||||
statComm.setTime(now - startTime);
|
||||
statComm.setLastSecond(0);
|
||||
statComm.setHost(getConnectedBinHost());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ namespace Mist{
|
|||
if (lastSecs != currSecs){
|
||||
lastSecs = currSecs;
|
||||
// Connect to stats for INPUT detection
|
||||
statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);
|
||||
statComm.reload(streamName, getConnectedBinHost(), JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "");
|
||||
if (statComm){
|
||||
if (statComm.getStatus() == COMM_STATUS_REQDISCONNECT){
|
||||
config->is_active = false;
|
||||
|
@ -217,7 +217,6 @@ namespace Mist{
|
|||
statComm.setUp(bytesUp);
|
||||
statComm.setTime(now - startTime);
|
||||
statComm.setLastSecond(0);
|
||||
statComm.setHost(getConnectedBinHost());
|
||||
}
|
||||
}
|
||||
// If the error flag is raised or we are lacking data, try to recover
|
||||
|
|
|
@ -621,7 +621,7 @@ namespace Mist{
|
|||
// Check for and spawn threads here.
|
||||
if (Util::bootSecs() - threadCheckTimer > 1){
|
||||
// Connect to stats for INPUT detection
|
||||
statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);
|
||||
statComm.reload(streamName, getConnectedBinHost(), JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "");
|
||||
if (statComm){
|
||||
if (statComm.getStatus() & COMM_STATUS_REQDISCONNECT){
|
||||
config->is_active = false;
|
||||
|
@ -636,7 +636,6 @@ namespace Mist{
|
|||
statComm.setDown(downCounter + tcpCon.dataDown());
|
||||
statComm.setTime(now - startTime);
|
||||
statComm.setLastSecond(0);
|
||||
statComm.setHost(getConnectedBinHost());
|
||||
}
|
||||
|
||||
std::set<size_t> activeTracks = liveStream.getActiveTracks();
|
||||
|
|
|
@ -284,7 +284,7 @@ namespace Mist{
|
|||
}
|
||||
|
||||
|
||||
void inputTSRIST::connStats(Comms::Statistics &statComm){
|
||||
void inputTSRIST::connStats(Comms::Connections &statComm){
|
||||
statComm.setUp(0);
|
||||
statComm.setDown(downBytes);
|
||||
statComm.setHost(getConnectedBinHost());
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Mist{
|
|||
int64_t timeStampOffset;
|
||||
uint64_t lastTimeStamp;
|
||||
|
||||
virtual void connStats(Comms::Statistics &statComm);
|
||||
virtual void connStats(Comms::Connections &statComm);
|
||||
|
||||
struct rist_ctx *receiver_ctx;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue