Converted comms system entirely to being bitflag-based instead of integer state based

This commit is contained in:
Thulinma 2020-12-04 16:26:57 +01:00
parent 6e316663fc
commit 974380ab30
10 changed files with 28 additions and 24 deletions

View file

@ -1365,7 +1365,7 @@ namespace Mist{
/*LTS-END*/
stats(true);
if (statComm){statComm.setStatus(COMM_STATUS_DISCONNECT);}
if (statComm){statComm.setStatus(COMM_STATUS_DISCONNECT | statComm.getStatus());}
userSelect.clear();
@ -1676,7 +1676,7 @@ namespace Mist{
HIGH_MSG("Writing stats: %s, %s, %u, %lu, %lu", getConnectedHost().c_str(), streamName.c_str(),
crc & 0xFFFFFFFFu, myConn.dataUp(), myConn.dataDown());
/*LTS-START*/
if (statComm.getStatus() == COMM_STATUS_REQDISCONNECT){
if (statComm.getStatus() & COMM_STATUS_REQDISCONNECT){
onFail("Shutting down on controller request");
return;
}
@ -1709,7 +1709,7 @@ namespace Mist{
if (isPushing()){
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
if (it->second.getStatus() == COMM_STATUS_REQDISCONNECT){
if (it->second.getStatus() & COMM_STATUS_REQDISCONNECT){
if (dropPushTrack(it->second.getTrack(), "disconnect request from buffer")){break;}
}
if (!it->second){

View file

@ -227,7 +227,7 @@ namespace Mist{
streamName.c_str(), handler.c_str(), H.GetVar("stream").c_str());
streamName = H.GetVar("stream");
userSelect.clear();
if (statComm){statComm.setStatus(COMM_STATUS_DISCONNECT);}
if (statComm){statComm.setStatus(COMM_STATUS_DISCONNECT | statComm.getStatus());}
reConnector(handler);
onFail("Server error - could not start connector", true);
return;

View file

@ -361,7 +361,7 @@ namespace Mist{
HTTP_S.SetHeader("Cache-Control", "no-cache");
if (trackNo != INVALID_TRACK_ID){
userSelect[trackNo].reload(streamName, trackNo);
if (isPushing()){userSelect[trackNo].setStatus(COMM_STATUS_SOURCE);}
if (isPushing()){userSelect[trackNo].setStatus(COMM_STATUS_SOURCE | userSelect[trackNo].getStatus());}
SDP::Track &sdpTrack = sdpState.tracks[trackNo];
if (sdpTrack.channel != -1){expectTCP = true;}
HTTP_S.SetHeader("Transport", sdpTrack.transportString);