void CryptobullionCore::initialize() { try { printf("Running AppInit2 in thread\n"); int rv = AppInit2(threadGroup); if(rv) { /* Start a dummy RPC thread if no RPC thread is active yet * to handle timeouts. */ //StartDummyRPCThread(); } emit initializeResult(rv); } catch (std::exception& e) { handleRunawayException(&e); } catch (...) { handleRunawayException(NULL); } }
int main(int argc, char *argv[]){ //Check option values from command line. //checkOption(argc, argv); //Apply option values to simulation settings. simSetting(argc,argv); if((gFileSta=fopen("sta's buffer.txt", "w"))==NULL){ printf("File cannot open! 3"); exit(33); } staInfo *sta; sta = (staInfo*)malloc(sizeof(staInfo)*gSpec.numSta); apInfo ap; resultInfo result; //Intialize result information. initializeResult(&result); if(gSpec.fDebug==true){ debug(); //printf("End debug.\n"); //exit(99); } int numTx = 0; int trialID; bool fEmpty = false; for (trialID=0; trialID<gSpec.numTrial; trialID++){ srand(trialID); numTx = 0; fEmpty = false; initializeNodeInfo(sta, &ap); gElapsedTime = (double)gStd.difs; idle(sta, &ap, &numTx, &fEmpty); //Wrong? fEmpty=true? for(; gElapsedTime<gSpec.simTime*1000000;){ if(numTx==1){ //debugSta(&sta[7],7); txSuccess(sta, &ap, &numTx); fEmpty = true; for(int i=0; i<gSpec.numSta; i++){ if(sta[i].buffer[0].lengthMsdu!=0){ fEmpty = false; break; } } if(ap.buffer[0].lengthMsdu!=0){ fEmpty = false; } if(fEmpty==true){ idle(sta, &ap, &numTx, &fEmpty); }else{ afterSuccess(sta, &ap, &numTx); } }else{ txCollision(sta, &ap); afterCollision(sta, &ap, &numTx); } } simulationResult(sta, &ap, &result, trialID); } if(gSpec.fOutput==true){ fclose(gSpec.output); } fclose(gFileSta); free(sta); return 0; }