bool UJavascriptHttpRequest::ProcessRequest() { if (IsProcessing()) return false; Request->OnProcessRequestComplete().BindLambda([&](FHttpRequestPtr, FHttpResponsePtr, bool status){ EndProcessing(); OnComplete.ExecuteIfBound(status); }); Request->OnRequestProgress().BindLambda([&](FHttpRequestPtr, int32 sent, int32 recv){ EndProcessing(); OnProgress.ExecuteIfBound(sent,recv); }); if (Request->ProcessRequest()) { BeginProcessing(); return true; } else { return false; } }
int procQTask() { char ProcId[EXPID_LEN]; char ActiveId[EXPID_LEN]; int proctype,activetype,fgbg,pid; long fid,ct; int dCode,eCode; int activeDcode; DPRINT(1,"Procproc: start procQtask()(chk processing Q)\n"); if ( procQget(&proctype, ProcId, &fid, &ct, &dCode, &eCode) == -1) /* nothin in Q ? */ return(0); DPRINT2(1,"Procproc: got Qed Task, Done Code: %d Error Code: %d\n",dCode,eCode); if (activeQget(&activetype, ActiveId, &fgbg, &pid, &activeDcode ) == -1) /* no active processing */ { if (ProcExpInfo.ExpInfo == NULL) { /* map in new processing Exp Info file */ strncpy(ProcExpInfo.ExpId,ProcId,EXPID_LEN); ProcExpInfo.ExpId[EXPID_LEN-1] = '\0'; if (mapInExp(&ProcExpInfo) == -1) { /* if expinfo file not there skip this processing, * remove it from the process queue, and get the next * queued item. */ ProcExpInfo.ExpInfo = NULL; procQdelete(proctype, 1); procQTask(); return(0); } /* Both ProcExpInfo & ActiveExpInfo were NULL so they will be the same */ /* memcpy((char*)&ActiveExpInfo,(char*)&ProcExpInfo, sizeof(ExpInfoEntry)); */ UpdateStatus(&ProcExpInfo); } else /* is the present ProcExpInfo the right one */ { if( strcmp(ProcExpInfo.ExpId,ProcId) != 0) /* NO, close one, open new */ { mapOutExp(&ProcExpInfo); /* map in new processing Exp Info file */ strncpy(ProcExpInfo.ExpId,ProcId,EXPID_LEN); ProcExpInfo.ExpId[EXPID_LEN-1] = '\0'; if (mapInExp(&ProcExpInfo) == -1) { /* if expinfo file not there skip this processing, * remove it from the process queue, and get the next * queued item. */ ProcExpInfo.ExpInfo = NULL; procQdelete(proctype, 1); procQTask(); return(0); } UpdateStatus(&ProcExpInfo); } } BeginProcessing(&ProcExpInfo, proctype, fid, ct, dCode, eCode); } else /* There is an active processing going on */ { if ( (proctype != WEXP_WAIT) && (proctype != WEXP) && (proctype != WERR) ) { /* Only check active queue at WEXP and WERR */ return(0); } if (ActiveExpInfo.ExpInfo == NULL) { char vnhost[256]; int vnport, vnpid; /* map in new processing Exp Info file */ strncpy(ActiveExpInfo.ExpId,ActiveId,EXPID_LEN); ActiveExpInfo.ExpId[EXPID_LEN-1] = '\0'; if (mapInExp(&ActiveExpInfo) == -1) { /* If the info file is not there, active element is done */ ActiveExpInfo.ExpInfo = NULL; activeQdelete(FG,pid); procQTask(); return(0); } if (fgbg == BG) { vnpid = pid; } else { sscanf(ActiveExpInfo.ExpInfo->MachineID, "%s %d %d", vnhost,&vnport,&vnpid); } if (( kill(vnpid,0) == -1) && (errno == ESRCH)) { /* if the process which was doing active processing is gone, * remove the active element */ activeQdelete(FG,pid); mapOutExp(&ActiveExpInfo); ActiveExpInfo.ExpInfo = NULL; unlink(ActiveId); /* delete exp info file */ procQTask(); } else if (fgbg == BG) { /* if the process which was doing active processing is present, * but in background, just let it continue */ mapOutExp(&ActiveExpInfo); ActiveExpInfo.ExpInfo = NULL; } else if (recheckFG) { char msgestring[256]; /* if the process which was doing active processing is present, * send another message for FGcomplt(). If it is still busy, * the message will be queued and an extra FGcomplt will be * delivered. It will be ignored. */ sprintf(msgestring,"acqsend('%d,0,','check')\n", (int)FGkey); deliverMessage( ActiveExpInfo.ExpInfo->MachineID, msgestring ); mapOutExp(&ActiveExpInfo); ActiveExpInfo.ExpInfo = NULL; /* * avoid sending a lot of these messages. This gets reset to 1 whenever * a FG message is received. */ recheckFG = 0; } } } return(0); }