Shared memory logic fix for quick disconnecting users, small tweak to sync byte reporting

This commit is contained in:
Thulinma 2019-01-06 13:51:58 +01:00
parent 5c074757f1
commit 7f3b61978f
2 changed files with 20 additions and 18 deletions

View file

@ -516,7 +516,7 @@ uint32_t Controller::statSession::kill(){
/// Updates the given active connection with new stats data. /// Updates the given active connection with new stats data.
void Controller::statSession::update(unsigned long index, IPC::statExchange & data){ void Controller::statSession::update(unsigned long index, IPC::statExchange & data){
//update the sync byte: 0 = requesting fill, 2 = requesting refill, 1 = needs checking, > 1 = state known (100=denied, 10=accepted) //update the sync byte: 0 = requesting fill, 2 = requesting refill, 1 = needs checking, > 2 = state known (100=denied, 10=accepted)
if (!data.getSync()){ if (!data.getSync()){
sessIndex tmpidx(data); sessIndex tmpidx(data);
std::string myHost = tmpidx.host; std::string myHost = tmpidx.host;

View file

@ -282,6 +282,10 @@ namespace Mist{
stats(true); stats(true);
tmpEx = IPC::statExchange(statsPage.getData()); tmpEx = IPC::statExchange(statsPage.getData());
} }
//If we aren't online, skip any further checks.
//We don't immediately return, so the recursing = false line only
//needs to be written once and will always be executed.
if (keepGoing()){
HIGH_MSG("USER_NEW sync achieved: %u", (unsigned int)tmpEx.getSync()); HIGH_MSG("USER_NEW sync achieved: %u", (unsigned int)tmpEx.getSync());
//1 = check requested (connection is new) //1 = check requested (connection is new)
if (tmpEx.getSync() == 1){ if (tmpEx.getSync() == 1){
@ -294,13 +298,11 @@ namespace Mist{
} }
} }
//100 = denied //100 = denied
if (tmpEx.getSync() == 100){ if (tmpEx.getSync() == 100){onFail("Not allowed to play (USER_NEW cache)");}
onFail("Not allowed to play (USER_NEW cache)"); if (tmpEx.getSync() == 0){onFail("Not allowed to play (USER_NEW init timeout)", true);}
} if (tmpEx.getSync() == 2){onFail("Not allowed to play (USER_NEW re-init timeout)", true);}
if (tmpEx.getSync() == 0 || tmpEx.getSync() == 2){
onFail("Not allowed to play (USER_NEW timeout)", true);
}
//anything else = accepted //anything else = accepted
}
}else{ }else{
tmpEx.setSync(10);//auto-accept if no trigger tmpEx.setSync(10);//auto-accept if no trigger
} }