Sessions rework

This commit is contained in:
Ramkoemar 2021-10-18 14:29:13 +02:00 committed by Thulinma
parent 3e85da2afd
commit 074e757028
27 changed files with 1222 additions and 1183 deletions

View file

@ -794,7 +794,7 @@ namespace Mist{
void Input::streamMainLoop(){
uint64_t statTimer = 0;
uint64_t startTime = Util::bootSecs();
Comms::Statistics statComm;
Comms::Connections statComm;
getNext();
if (thisPacket && !userSelect.count(thisIdx)){
userSelect[thisIdx].reload(streamName, thisIdx, COMM_STATUS_ACTIVE | COMM_STATUS_SOURCE | COMM_STATUS_DONOTTRACK);
@ -820,7 +820,7 @@ namespace Mist{
if (Util::bootSecs() - statTimer > 1){
// Connect to stats for INPUT detection
if (!statComm){statComm.reload();}
if (!statComm){statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);}
if (statComm){
if (!statComm){
config->is_active = false;
@ -829,7 +829,6 @@ namespace Mist{
}
uint64_t now = Util::bootSecs();
statComm.setNow(now);
statComm.setCRC(getpid());
statComm.setStream(streamName);
statComm.setConnector("INPUT:" + capa["name"].asStringRef());
statComm.setTime(now - startTime);
@ -842,7 +841,7 @@ namespace Mist{
}
}
void Input::connStats(Comms::Statistics &statComm){
void Input::connStats(Comms::Connections &statComm){
statComm.setUp(0);
statComm.setDown(streamByteCount());
statComm.setHost(getConnectedBinHost());
@ -853,7 +852,7 @@ namespace Mist{
uint64_t statTimer = 0;
uint64_t startTime = Util::bootSecs();
size_t idx;
Comms::Statistics statComm;
Comms::Connections statComm;
DTSC::Meta liveMeta(config->getString("streamname"), false);
@ -985,7 +984,7 @@ namespace Mist{
if (Util::bootSecs() - statTimer > 1){
// Connect to stats for INPUT detection
if (!statComm){statComm.reload();}
if (!statComm){statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);}
if (statComm){
if (statComm.getStatus() & COMM_STATUS_REQDISCONNECT){
config->is_active = false;
@ -994,7 +993,6 @@ namespace Mist{
}
uint64_t now = Util::bootSecs();
statComm.setNow(now);
statComm.setCRC(getpid());
statComm.setStream(streamName);
statComm.setConnector("INPUT:" + capa["name"].asStringRef());
statComm.setTime(now - startTime);

View file

@ -69,7 +69,7 @@ namespace Mist{
virtual void userOnActive(size_t id);
virtual void userOnDisconnect(size_t id);
virtual void userLeadOut();
virtual void connStats(Comms::Statistics & statComm);
virtual void connStats(Comms::Connections & statComm);
virtual void parseHeader();
bool bufferFrame(size_t track, uint32_t keyNum);

View file

@ -196,7 +196,7 @@ namespace Mist{
}
void InputRTSP::streamMainLoop(){
Comms::Statistics statComm;
Comms::Connections statComm;
uint64_t startTime = Util::epoch();
uint64_t lastPing = Util::bootSecs();
uint64_t lastSecs = 0;
@ -210,7 +210,7 @@ namespace Mist{
if (lastSecs != currSecs){
lastSecs = currSecs;
// Connect to stats for INPUT detection
statComm.reload();
statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);
if (statComm){
if (statComm.getStatus() & COMM_STATUS_REQDISCONNECT){
config->is_active = false;
@ -219,7 +219,6 @@ namespace Mist{
}
uint64_t now = Util::bootSecs();
statComm.setNow(now);
statComm.setCRC(getpid());
statComm.setStream(streamName);
statComm.setConnector("INPUT:" + capa["name"].asStringRef());
statComm.setUp(tcpCon.dataUp());

View file

@ -193,7 +193,7 @@ namespace Mist{
// Updates stats and quits if parsePacket returns false
void InputSDP::streamMainLoop(){
Comms::Statistics statComm;
Comms::Connections statComm;
uint64_t startTime = Util::epoch();
uint64_t lastSecs = 0;
// Get RTP packets from UDP socket and stop if this fails
@ -202,7 +202,7 @@ namespace Mist{
if (lastSecs != currSecs){
lastSecs = currSecs;
// Connect to stats for INPUT detection
statComm.reload();
statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);
if (statComm){
if (statComm.getStatus() == COMM_STATUS_REQDISCONNECT){
config->is_active = false;
@ -211,7 +211,6 @@ namespace Mist{
}
uint64_t now = Util::bootSecs();
statComm.setNow(now);
statComm.setCRC(getpid());
statComm.setStream(streamName);
statComm.setConnector("INPUT:" + capa["name"].asStringRef());
statComm.setDown(bytesRead);

View file

@ -527,7 +527,7 @@ namespace Mist{
void inputTS::streamMainLoop(){
meta.removeTrack(tmpIdx);
INFO_MSG("Removed temptrack %zu", tmpIdx);
Comms::Statistics statComm;
Comms::Connections statComm;
uint64_t downCounter = 0;
uint64_t startTime = Util::bootSecs();
uint64_t noDataSince = Util::bootSecs();
@ -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();
statComm.reload(streamName, "", JSON::Value(getpid()).asString(), "INPUT:" + capa["name"].asStringRef(), "", SESS_BUNDLE_STREAMNAME_HOSTNAME_SESSIONID);
if (statComm){
if (statComm.getStatus() & COMM_STATUS_REQDISCONNECT){
config->is_active = false;
@ -630,7 +630,6 @@ namespace Mist{
}
uint64_t now = Util::bootSecs();
statComm.setNow(now);
statComm.setCRC(getpid());
statComm.setStream(streamName);
statComm.setConnector("INPUT:" + capa["name"].asStringRef());
statComm.setUp(0);

View file

@ -282,7 +282,7 @@ namespace Mist{
void inputTSSRT::setSingular(bool newSingular){singularFlag = newSingular;}
void inputTSSRT::connStats(Comms::Statistics &statComm){
void inputTSSRT::connStats(Comms::Connections &statComm){
statComm.setUp(srtConn.dataUp());
statComm.setDown(srtConn.dataDown());
statComm.setHost(getConnectedBinHost());

View file

@ -40,7 +40,7 @@ namespace Mist{
Socket::SRTConnection srtConn;
bool singularFlag;
virtual void connStats(Comms::Statistics &statComm);
virtual void connStats(Comms::Connections &statComm);
Util::ResizeablePointer rawBuffer;
size_t rawIdx;