Clean up some of the dispatcher multi-threading, and turn off some debugging in the auth manager.

This commit is contained in:
Ken Moore
2016-02-29 16:15:20 -05:00
parent 718ed8f594
commit 3cebb77190
2 changed files with 10 additions and 8 deletions

View File

@@ -47,7 +47,7 @@ void AuthorizationManager::clearAuth(QString token){
if(token.isEmpty() || token.length() < TOKENLENGTH){ return; } //not a valid token
//clear an authorization token
QString id = hashID(token);
qDebug() << "Clear Auth:" << id;
//qDebug() << "Clear Auth:" << id;
if(!id.isEmpty()){ HASH.remove(id); }
}
@@ -289,7 +289,7 @@ QString AuthorizationManager::generateNewToken(bool isOp, QString user){
//unique token created - add it to the hash with the current time (+timeout)
QString id = tok + "::::"+(isOp ? "operator" : "user")+"::::"+user; //append operator status to auth key
HASH.insert(id, QDateTime::currentDateTime().addSecs(TIMEOUTSECS) );
qDebug() << "Current HASH Contents:" << HASH.keys();
//qDebug() << "Current HASH Contents:" << HASH.keys();
}
return tok;
}

View File

@@ -41,7 +41,7 @@ void DProcess::startProc(){
connect(this, SIGNAL(error(QProcess::ProcessError)), this, SLOT(cmdError(QProcess::ProcessError)) );
}
proclog.append("[Running Command: "+cmd+" ]");
//qDebug() << "Proc Starting:" << ID << cmd;
qDebug() << "Proc Starting:" << ID << cmd;
this->start(cmd);
}
@@ -138,18 +138,18 @@ DProcess* Dispatcher::queueProcess(Dispatcher::PROC_QUEUE queue, QString ID, QSt
//Simplification routine for setting up a process
DProcess* Dispatcher::createProcess(QString ID, QStringList cmds){
DProcess *P = new DProcess();
//P->moveToThread(this->thread());
P->moveToThread(this->thread());
P->cmds = cmds;
P->ID = ID;
connect(P, SIGNAL(ProcFinished(QString)), this, SLOT(ProcFinished(QString)) );
return P;
}
// === PRIVATE SLOTS ===
void Dispatcher::mkProcs(Dispatcher::PROC_QUEUE queue, DProcess *P){
//qDebug() << " - Create Process:" << queue << ID << cmds;
qDebug() << "mkProcs()";
//DProcess *P = createProcess(ID, cmds);
P->moveToThread(this->thread());
//P->moveToThread(this->thread());
connect(P, SIGNAL(ProcFinished(QString)), this, SLOT(ProcFinished(QString)) );
QList<DProcess*> list;
if(!HASH.contains(queue)){ HASH.insert(queue, list); } //insert an empty list
HASH[queue] << P; //add this proc to the end of the list
@@ -208,8 +208,10 @@ for(int i=0; i<enum_length; i++){
j--;
}else{
//Need to start this one - has not run yet
qDebug() << "Call Start Proc:" << list[j]->ID;
emit DispatchStarting(list[j]->ID);
QTimer::singleShot(0,list[j], SLOT(startProc()) );
list[j]->startProc();
//QTimer::singleShot(0,list[j], SLOT(startProc()) );
}
}
} //end loop over list