/** Attempt to send data queued for a client. * @param[in] to Client to send data to. */ void send_queued(struct Client *to) { assert(0 != to); assert(0 != cli_local(to)); if (IsBlocked(to) || !can_send(to)) return; /* Don't bother */ while (MsgQLength(&(cli_sendQ(to))) > 0) { unsigned int len; if ((len = deliver_it(to, &(cli_sendQ(to))))) { msgq_delete(&(cli_sendQ(to)), len); cli_lastsq(to) = MsgQLength(&(cli_sendQ(to))) / 1024; if (IsBlocked(to)) { update_write(to); return; } } else { if (IsDead(to)) { char tmp[512]; sprintf(tmp,"Write error: %s", ((cli_sslerror(to)) ? (cli_sslerror(to)) : ((strerror(cli_error(to))) ? (strerror(cli_error(to))) : "Unknown error")) ); dead_link(to, tmp); } return; } } /* Ok, sendq is now empty... */ client_drop_sendq(cli_connect(to)); update_write(to); }
// --------------------------------------------------------------------------- // CRestingState Signal handling // --------------------------------------------------------------------------- // CStateBase* CRestingState::SignalL(TSignal aSignal) { __ALFFXLOGSTRING1("CRestingState::SignalL %d (Alf)>>", aSignal); TInt error = KErrNone; switch( aSignal ) { case EBeginFullscreen: if( !IsBlocked( iEngine.FromUid(), iEngine.ToUid() ) ) { iEngine.SendBeginFullscreen(); return CPhase1State::NewL( iEngine,iHandler ); } return NULL; case EBeginComponent: error = iEngine.SendBeginControlTransition(); if ( error == KErrNone ) { return CControlState::NewL( iEngine, iHandler ); } return NULL; case EEndFullscreen: // iEngine.SendEndFullscreen(); // TODO: revise? // return CRestingState::NewL( iEngine, iHandler ); case EAbortFullscreen: iEngine.SendAbortFullscreen(); return CRestingState::NewL( iEngine, iHandler ); } return NULL; }
bool OnEmbeddedWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) { if (sPageName == "webadmin/user" && WebSock.GetSession()->IsAdmin()) { CString sAction = Tmpl["WebadminAction"]; if (sAction == "display") { Tmpl["Blocked"] = CString(IsBlocked(Tmpl["Username"])); Tmpl["Self"] = CString(Tmpl["Username"].Equals(WebSock.GetSession()->GetUser()->GetUserName())); return true; } if (sAction == "change" && WebSock.GetParam("embed_blockuser_presented").ToBool()) { if (Tmpl["Username"].Equals(WebSock.GetSession()->GetUser()->GetUserName()) && WebSock.GetParam("embed_blockuser_block").ToBool()) { WebSock.GetSession()->AddError("You can't block yourself"); } else if (WebSock.GetParam("embed_blockuser_block").ToBool()) { if (!WebSock.GetParam("embed_blockuser_old").ToBool()) { if (Block(Tmpl["Username"])) { WebSock.GetSession()->AddSuccess("Blocked [" + Tmpl["Username"] + "]"); } else { WebSock.GetSession()->AddError("Couldn't block [" + Tmpl["Username"] + "]"); } } } else if (WebSock.GetParam("embed_blockuser_old").ToBool()){ if (DelNV(Tmpl["Username"])) { WebSock.GetSession()->AddSuccess("Unblocked [" + Tmpl["Username"] + "]"); } else { WebSock.GetSession()->AddError("User [" + Tmpl["Username"] + "is not blocked"); } } return true; } } return false; }
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { if (IsBlocked(Auth->GetUsername())) { Auth->RefuseLogin(MESSAGE); return HALT; } return CONTINUE; }
bool cChestEntity::UsedBy(cPlayer * a_Player) { if (IsBlocked()) { // Obstruction, don't open return true; } if (m_Neighbour == nullptr) { ScanNeighbours(); } // The primary chest should be the one with lesser X or Z coord: cChestEntity * PrimaryChest = this; if (m_Neighbour != nullptr) { if (m_Neighbour->IsBlocked()) { // Obstruction, don't open return true; } if ( (m_Neighbour->GetPosX() > GetPosX()) || (m_Neighbour->GetPosZ() > GetPosZ()) ) { PrimaryChest = m_Neighbour; } } // If the window is not created, open it anew: cWindow * Window = PrimaryChest->GetWindow(); if (Window == nullptr) { PrimaryChest->OpenNewWindow(); Window = PrimaryChest->GetWindow(); } // Open the window for the player: if (Window != nullptr) { if (a_Player->GetWindow() != Window) { a_Player->OpenWindow(*Window); } } // This is rather a hack // Instead of marking the chunk as dirty upon chest contents change, we mark it dirty now // We cannot properly detect contents change, but such a change doesn't happen without a player opening the chest first. // The few false positives aren't much to worry about int ChunkX, ChunkZ; cChunkDef::BlockToChunk(m_PosX, m_PosZ, ChunkX, ChunkZ); m_World->MarkChunkDirty(ChunkX, ChunkZ); return true; }
//--------------------------------------------------------- //--------------------------------------------------------- bool CNPC_Roller::IsBlockedBackward( void ) { Vector vecLinear; VPhysicsGetObject()->GetVelocity( &vecLinear, NULL ); VectorNormalize( vecLinear ); vecLinear *= ROLLER_CHECK_DIST; return IsBlocked( vecLinear ); }
void StupidBehaviour::ReactToObstacle() { // Turn to face new direction. // TODO smoothly turn to face new direction m_pCharacter->RotateY(GetTurnDir()); // If the new direction is blocked, try the opposite direction. // Otherwise Stupids will be excessively stupid, and backtrack rather than // going in the available new direction. // (If both directions are blocked, the call in the next frame will cause // backtracking.) if (IsBlocked()) { m_pCharacter->RotateY(180.0f); // go in the opposite direction. } }
void StupidBehaviour::Update() { m_pCharacter->SetForwardVel(5.0f); // TODO TEMP TEST /* // Hopefully AvoidObstacles will take case of turning when we hit a wall // (or another Character) AvoidObstacles(); */ if (IsBlocked()) { // Too annoying when there are lots of Stupids // Engine::Instance()->PlayWav(Engine::Instance()->GetConfigValue("wav_hitswall")); ReactToObstacle(); } }
SpatialGraphKDNode* SpatialGraph::CreateTree(int depth, const BoundingBox& bbox, SpatialGraphKDNode* parent, int index) { SpatialGraphKDNode* node = new SpatialGraphKDNode(bbox, parent); node->Tree = this; node->bBlocked = false; //query physics to see if we're blocked node->bBlocked = IsBlocked( bbox ); //Calculate my index if( parent ) { node->Index = index; } else { node->Index = 0; } //Bail out if we reach max depth depth--; node->Depth = _depth - depth; if (depth > 0 && node->bBlocked ) { BoundingBox LHSbbox, RHSbbox; MathUtil::SplitBoundingBox( bbox, (depth % 2) ? MathUtil::AA_X : MathUtil::AA_Y, LHSbbox, RHSbbox ); node->LHC = CreateTree(depth, LHSbbox, node, node->Index << 1); node->RHC = CreateTree(depth, RHSbbox, node, (node->Index << 1) + 1); int iMask = ~(0xFFFFFFFF << depth ); //If I have children, pad my index node->Index = (node->Index << depth) | iMask; //If all my children are blocked, then destroy my children if( IsFullyBlocked(node) ) { DeleteNode( node->LHC ); node->LHC = NULL; DeleteNode( node->RHC ); node->RHC = NULL; } } return node; }
// --------------------------------------------------------------------------- // CPhase1State Signal handling // --------------------------------------------------------------------------- // CStateBase* CPhase1State::SignalL(TSignal aSignal) { TInt error = KErrNone; __ALFFXLOGSTRING1("CPhase1State::SignalL(TSignal %d) (Alf)", aSignal); switch(aSignal) { case EAbort: case EAbortFullscreen: iEngine.SendAbortFullscreen(); return CRestingState::NewL(iEngine,iHandler); case EFinishFullscreen: if ( !iEngine.EffectFinishedFullScreen() ) { iEngine.SendAbortFullscreen(); } return CRestingState::NewL(iEngine,iHandler); case EEndFullscreen: TInt triggeredLongStartEffect = iEngine.SendEndFullscreen(); __ALFFXLOGSTRING1("CPhase1State::SignalL - Was long app start triggered? Stay in Phase1", triggeredLongStartEffect); if (triggeredLongStartEffect) { return CPhase1State::NewL(iEngine,iHandler); } else { return CPhase2State::NewL(iEngine,iHandler); } case EBeginFullscreen: if(!IsBlocked(iEngine.FromUid(),iEngine.ToUid())) { iEngine.SendBeginFullscreen(); } return NULL; case EBeginComponent: error = iEngine.SendBeginControlTransition(); if ( error == KErrNone ) { return CControlState::NewL( iEngine, iHandler ); } return NULL; } return NULL; }
// --------------------------------------------------------------------------- // CPhase2State Signal handling // --------------------------------------------------------------------------- // CStateBase* CPhase2State::SignalL(TSignal aSignal) { TInt error = KErrNone; __ALFFXLOGSTRING1("CPhase2State::SignalL %d (Alf)>>", aSignal); switch(aSignal) { case EAbort: case EAbortFullscreen: iEngine.SendAbortFullscreen(); return CRestingState::NewL(iEngine,iHandler); case EFinishFullscreen: if ( ( iEngine.Action() == 1001 || iEngine.Action() == AknTransEffect::EApplicationExit ) && !iEngine.EffectFinishedFullScreen() ) { iEngine.SendAbortFullscreen(); } return CRestingState::NewL(iEngine,iHandler); case EBeginFullscreen: if(!IsBlocked(iEngine.FromUid(),iEngine.ToUid())) { iEngine.SendBeginFullscreen(); return CPhase1State::NewL(iEngine,iHandler); } return NULL; case EEndFullscreen: iEngine.SendEndFullscreen(); return NULL; case EBeginComponent: error = iEngine.SendBeginControlTransition(); if ( error == KErrNone ) { return CControlState::NewL( iEngine, iHandler ); } return NULL; } return NULL; }
// --------------------------------------------------------------------------- // CControlState signal handling // --------------------------------------------------------------------------- // CStateBase* CControlState::SignalL(TSignal aSignal) { __ALFFXLOGSTRING1("CControlState::SignalL %d (Alf)>>", aSignal); TInt error = KErrNone; switch( aSignal ) { case EAbort: case EAbortComponent: iEngine.SendAbortControlTransition(); return CRestingState::NewL( iEngine, iHandler ); case EFinishComponent: // do something to finish iEngine.SendFinishControlTransition(); return CRestingState::NewL( iEngine, iHandler ); case EBeginFullscreen: if( !IsBlocked( iEngine.FromUid(), iEngine.ToUid() ) ) { iEngine.SendBeginFullscreen(); return CPhase1State::NewL( iEngine,iHandler ); } return NULL; case EBeginComponent: // we don't limit control transitions // we don't have an ending signal for the controls now // We may need something to be able to call // SendFinishControlTransition error = iEngine.SendBeginControlTransition(); if ( error == KErrNone ) { return CControlState::NewL( iEngine, iHandler ); } return NULL; } return NULL; }
/* Converts a point-request into a square-positional request. */ int CMoveMath::IsBlocked(const MoveData& moveData, float3 pos) { int x = (int)(pos.x / SQUARE_SIZE); int z = (int)(pos.z / SQUARE_SIZE); return IsBlocked(moveData, x, z); }
/* virtual */ OP_STATUS ES_Thread::EvaluateThread() { OP_NEW_DBG("ES_Thread::EvaluateThread", "es_utils"); OP_DBG(("thread=%p, ES_Context=%p", this, context)); SCRIPT_THREAD_EVALUATION_PROBE(probe, scheduler, thread_id); ES_Eval_Status eval_ret; OP_STATUS ret = OpStatus::OK; OpStatus::Ignore(ret); if (!context) { OP_ASSERT(FALSE); return OpStatus::ERR; } if (!is_started) { if (GetProgram() && GetPushProgram()) RETURN_IF_ERROR(scheduler->GetRuntime()->PushProgram(context, GetProgram())); else if (GetCallable()) RETURN_IF_ERROR(ES_Runtime::PushCall(context, GetCallable(), GetCallableArgc(), GetCallableArgv())); is_started = TRUE; } is_suspended = FALSE; eval_ret = ES_Runtime::ExecuteContext(context, WantStringResult(), WantExceptions(), AllowCrossOriginErrors(), &ES_TimesliceExpired, scheduler); switch (eval_ret) { case ES_SUSPENDED: is_suspended = TRUE; break; case ES_NORMAL: is_completed = TRUE; break; case ES_NORMAL_AFTER_VALUE: is_completed = returned_value = TRUE; break; case ES_ERROR: is_completed = is_failed = TRUE; break; case ES_ERROR_NO_MEMORY: ret = OpStatus::ERR_NO_MEMORY; break; case ES_BLOCKED: if (!IsBlocked()) is_suspended = TRUE; break; case ES_THREW_EXCEPTION: OP_ASSERT(WantExceptions()); is_completed = is_failed = returned_value = TRUE; break; default: ret = OpStatus::ERR; break; } if (OpStatus::IsError(ret)) { is_completed = TRUE; is_failed = TRUE; } while (ES_RestartObject *top = restart_object_discarded) { restart_object_discarded = top->next; OP_DELETE(top); } return ret; }
/* virtual */ OP_STATUS ES_JavascriptURLThread::EvaluateThread() { OP_STATUS ret = OpStatus::OK; switch (eval_state) { case STATE_INITIAL: { eval_state = STATE_SET_PROGRAM; #ifdef USER_JAVASCRIPT DOM_Environment *environment = scheduler->GetFramesDocument()->GetDOMEnvironment(); RETURN_IF_ERROR(environment->HandleJavascriptURL(this)); if (IsBlocked()) return OpStatus::OK; #endif // USER_JAVASCRIPT } // fall through case STATE_SET_PROGRAM: if (source) { ES_ProgramText program_text; program_text.program_text = source; program_text.program_text_length = uni_strlen(source); ES_Runtime *runtime = scheduler->GetRuntime(); ES_Program *program; OP_STATUS status; ES_Runtime::CompileProgramOptions options; options.generate_result = TRUE; options.global_scope = FALSE; options.script_type = SCRIPT_TYPE_JAVASCRIPT_URL; options.when = UNI_L("while loading"); options.script_url = &url; #ifdef ECMASCRIPT_DEBUGGER options.reformat_source = g_ecmaManager->GetWantReformatScript(runtime); #endif // ECMASCRIPT_DEBUGGER if (OpStatus::IsSuccess(status = runtime->CompileProgram(&program_text, 1, &program, options))) if (program) SetProgram(program); else status = OpStatus::ERR; if (OpStatus::IsMemoryError(status)) { is_completed = is_failed = TRUE; return status; } else if (OpStatus::IsError(status)) { is_completed = is_failed = TRUE; return OpStatus::OK; } } eval_state = STATE_EVALUATE; // fall through case STATE_EVALUATE: { ret = ES_Thread::EvaluateThread(); if (OpStatus::IsError(ret)) { eval_state = STATE_HANDLE_RESULT; is_completed = TRUE; break; } else if (IsCompleted()) { if (IsFailed()) { eval_state = STATE_DONE; break; } else #ifdef USER_JAVASCRIPT eval_state = STATE_SEND_USER_JS_AFTER; #else // USER_JAVASCRIPT eval_state = STATE_HANDLE_RESULT; #endif // USER_JAVASCRIPT } else break; } // fall through #ifdef USER_JAVASCRIPT case STATE_SEND_USER_JS_AFTER: { DOM_Environment *environment = scheduler->GetFramesDocument()->GetDOMEnvironment(); RETURN_IF_ERROR(environment->HandleJavascriptURLFinished(this)); eval_state = STATE_HANDLE_RESULT; if (IsBlocked()) { is_completed = FALSE; break; } } // fall through #endif // USER_JAVASCRIPT case STATE_HANDLE_RESULT: { is_completed = TRUE; const uni_char *use_result = NULL; #ifdef USER_JAVASCRIPT if (has_result) use_result = result; else #endif // USER_JAVASCRIPT if (ReturnedValue()) { ES_Value return_value; RETURN_IF_ERROR(GetReturnedValue(&return_value)); if (return_value.type == VALUE_STRING) use_result = return_value.value.string; } FramesDocument *frames_doc = GetFramesDocument(); OP_ASSERT(frames_doc); // Since we're executing we must be in a document if (use_result) { if (write_result_to_document) { // The HTML5 spec says that we should load this data exactly as if it had come // from an HTTP connection with content type text/html and status 200. This // is a very bad approximation of that. BOOL is_busy = scheduler->IsDraining() || !frames_doc->IsCurrentDoc(); write_result_to_document = FALSE; // Since it's enough to do it once frames_doc->SetWaitForJavascriptURL(FALSE); if (!is_busy) if (HLDocProfile *hld_profile = frames_doc->GetHLDocProfile()) is_busy = hld_profile->GetESLoadManager()->GetScriptGeneratingDoc(); if (!is_busy) { if (GetOriginInfo().open_in_new_window) RETURN_IF_ERROR(DOM_Environment::OpenWindowWithData(use_result, frames_doc, this, GetOriginInfo().is_user_requested)); else { // The ESOpen()/ESClose() calls are just done in order to create an // empty document in The Right Way(tm) in order to parse some data // into it as if it had been loaded from a URL, and not to set up // a document.write call like they are usually used for. ESDocException doc_exception; // Ignored RETURN_IF_ERROR(frames_doc->ESOpen(scheduler->GetRuntime(), &url, is_reload, NULL, NULL, &doc_exception)); FramesDocument *new_frames_doc = frames_doc->GetDocManager()->GetCurrentDoc(); RETURN_IF_ERROR(new_frames_doc->ESClose(scheduler->GetRuntime())); SetBlockType(ES_BLOCK_NONE); if (frames_doc != new_frames_doc) RETURN_IF_ERROR(new_frames_doc->GetLogicalDocument()->ParseHtmlFromString(use_result, uni_strlen(use_result), FALSE, FALSE, FALSE)); else OP_ASSERT(!"ESOpen might have failed, but if it didn't then we're stuck with a hung thread in a document and nothing will work"); new_frames_doc->ESStoppedGeneratingDocument(); } } } if (write_result_to_url) { if (want_utf8) { UTF16toUTF8Converter converter; unsigned length = uni_strlen(use_result) * sizeof source[0], needed = converter.BytesNeeded(use_result, length); converter.Reset(); char *data; if (needed < g_memory_manager->GetTempBufLen()) data = (char *) g_memory_manager->GetTempBuf(); else data = OP_NEWA(char, needed); if (!data) { ret = OpStatus::ERR_NO_MEMORY; break; } else { int read, written = converter.Convert(use_result, length, data, needed, &read); url.WriteDocumentData(URL::KNormal, data, written); url.WriteDocumentDataFinished(); if (data != g_memory_manager->GetTempBuf()) OP_DELETEA(data); } } else { url.WriteDocumentData(URL::KNormal, use_result, uni_strlen(use_result)); url.WriteDocumentDataFinished(); } } } else if (write_result_to_document) { // The HTML5 spec says this should be handled as a HTTP status 204, NO_CONTENT frames_doc->GetMessageHandler()->PostMessage(MSG_URL_LOADING_FAILED, url.Id(), DH_ERRSTR(SI,ERR_HTTP_NO_CONTENT)); frames_doc->SetWaitForJavascriptURL(FALSE); write_result_to_document = FALSE; // Since it's done and we don't want to do it again. } eval_state = STATE_DONE; }
void WUploadThread::DoUpload() { PRINT("WUploadThread::DoUpload\n"); if (fShutdownFlag && *fShutdownFlag) // Do we need to interrupt? { ConnectTimer(); return; } // Still connected? if (!IsInternalThreadRunning()) { ConnectTimer(); return; } // Small files get to bypass queue if (IsLocallyQueued()) { if ( (fFile && (fFileSize >= gWin->fSettings->GetMinQueuedSize())) || IsManuallyQueued() ) { // not yet fForced = false; WUploadEvent *lq = new WUploadEvent(WUploadEvent::FileQueued); if (lq) { SendReply(lq); } return; } fForced = true; // Set this here to avoid duplicate call to DoUpload() } // Recheck if IP is ignored or not // if (gWin->IsIgnoredIP(fStrRemoteIP) && !IsBlocked()) { SetBlocked(true); } if (IsBlocked()) { WUploadEvent *wue = new WUploadEvent(WUploadEvent::FileBlocked); if (wue) { if (fTimeLeft != -1) wue->SetTime(fTimeLeft); SendReply(wue); } return; } if (fStartTime == 0) fStartTime = GetRunTime64(); if (fFile) { MessageRef uref(GetMessageFromPool(WTransfer::TransferFileData)); if (uref()) { // think about doing this in a dynamic way (depending on connection) double dpps = GetPacketSize() * 1024.0; uint32 bufferSize = lrint(dpps); ByteBufferRef buf = GetByteBufferFromPool(bufferSize); uint8 * scratchBuffer = buf()->GetBuffer(); if (scratchBuffer == NULL) { _nobuffer(); return; } int32 numBytes = 0; numBytes = fFile->ReadBlock32(scratchBuffer, bufferSize); if (numBytes > 0) { buf()->SetNumBytes(numBytes, true); // munge mode switch (fMungeMode) { case WTransfer::MungeModeNone: { uref()->AddInt32("mm", WTransfer::MungeModeNone); break; } case WTransfer::MungeModeXOR: { for (int32 x = 0; x < numBytes; x++) scratchBuffer[x] ^= 0xFF; uref()->AddInt32("mm", WTransfer::MungeModeXOR); break; } default: { break; } } if (uref()->AddFlat("data", buf) == B_OK) { // possibly do checksums here uref()->AddInt32("chk", CalculateFileChecksum(buf)); // a little paranoia, due to file-resumes not working.... (TCP should handle this BUT...) SendMessageToSessions(uref); // NOTE: RequestOutputQueuesDrainedNotification() can recurse, so we need to update the offset before // calling it! fCurrentOffset += numBytes; if (fTunneled) { SignalUpload(); } else { MessageRef drain(GetMessageFromPool()); if (drain()) qmtt->RequestOutputQueuesDrainedNotification(drain); } WUploadEvent *update = new WUploadEvent(WUploadEvent::FileDataSent); if (update) { update->SetOffset(fCurrentOffset); update->SetSize(fFileSize); update->SetSent(numBytes); if (fCurrentOffset >= fFileSize) { update->SetDone(true); // file done! update->SetFile(SimplifyPath(fFileUl)); if (gWin->fSettings->GetUploads()) { SystemEvent( gWin, tr("%1 has finished downloading %2.").arg( GetRemoteUser() ).arg( SimplifyPath(fFileUl) ) ); } } SendReply(update); } return; } else { _nobuffer(); return; } } if (numBytes <= 0) { NextFile(); SignalUpload(); return; } } } else { while (!fFile) { if (fUploads.GetNumItems() != 0) { // grab the ref and remove it from the list fUploads.RemoveHead(fCurrentRef); fFileUl = MakeUploadPath(fCurrentRef); #ifdef _DEBUG // <*****@*****.**> 20021023, 20030702 -- Add additional debug message WString wul(fFileUl); PRINT("WUploadThread::DoUpload: filePath = %S\n", wul.getBuffer()); #endif fFile = new WFile(); Q_CHECK_PTR(fFile); if (!fFile->Open(fFileUl, QIODevice::ReadOnly)) // probably doesn't exist { delete fFile; fFile = NULL; fCurFile++; continue; // onward } // got our file! fFileSize = fFile->Size(); fCurrentOffset = 0; // from the start if (fCurrentRef()->FindInt64("secret:offset", fCurrentOffset) == B_OK) { if (!fFile->Seek(fCurrentOffset)) // <*****@*****.**> 20021026 { fFile->Seek(0); // this can't fail :) (I hope) fCurrentOffset = 0; } } // copy the message in our current file ref MessageRef headRef = fCurrentRef.Clone(); if (headRef()) { headRef()->what = WTransfer::TransferFileHeader; headRef()->AddInt64("beshare:StartOffset", fCurrentOffset); SendMessageToSessions(headRef); } fCurFile++; // Reset statistics InitTransferRate(); InitTransferETA(); WUploadEvent *started = new WUploadEvent(WUploadEvent::FileStarted); if (started) { started->SetFile(SimplifyPath(fFileUl)); started->SetStart(fCurrentOffset); started->SetSize(fFileSize); #ifdef _DEBUG started->SetSession(fRemoteSessionID); #endif SendReply(started); } if (gWin->fSettings->GetUploads()) { SystemEvent( gWin, tr("%1 is downloading %2.").arg( GetRemoteUser() ).arg( SimplifyPath(fFileUl) ) ); } // nested call SignalUpload(); return; } else { PRINT("No more files!\n"); fWaitingForUploadToFinish = true; SetFinished(true); if (fTunneled) { _OutputQueuesDrained(); } else { MessageRef drain(GetMessageFromPool()); if (drain()) qmtt->RequestOutputQueuesDrainedNotification(drain); } break; } } } }
void UCrowdFollowingComponent::UpdatePathSegment() { if (!bEnableCrowdSimulation) { Super::UpdatePathSegment(); return; } if (!Path.IsValid() || MovementComp == NULL) { AbortMove(TEXT("no path"), FAIRequestID::CurrentRequest, true, false, EPathFollowingMessage::NoPath); return; } if (!Path->IsValid()) { if (!Path->IsWaitingForRepath()) { AbortMove(TEXT("no path"), FAIRequestID::CurrentRequest, true, false, EPathFollowingMessage::NoPath); } return; } // if agent has control over its movement, check finish conditions const bool bCanReachTarget = MovementComp->CanStopPathFollowing(); if (bCanReachTarget && Status == EPathFollowingStatus::Moving) { const FVector CurrentLocation = MovementComp->GetActorFeetLocation(); const FVector GoalLocation = GetCurrentTargetLocation(); if (bCollidedWithGoal) { // check if collided with goal actor OnSegmentFinished(); OnPathFinished(EPathFollowingResult::Success); } else if (bFinalPathPart) { const FVector ToTarget = (GoalLocation - MovementComp->GetActorFeetLocation()); const bool bDirectPath = Path->CastPath<FAbstractNavigationPath>() != NULL; const float SegmentDot = FVector::DotProduct(ToTarget, bDirectPath ? MovementComp->Velocity : CrowdAgentMoveDirection); const bool bMovedTooFar = bCheckMovementAngle && (SegmentDot < 0.0); // can't use HasReachedDestination here, because it will use last path point // which is not set correctly for partial paths without string pulling if (bMovedTooFar || HasReachedInternal(GoalLocation, 0.0f, 0.0f, CurrentLocation, AcceptanceRadius, bStopOnOverlap ? MinAgentRadiusPct : 0.0f)) { UE_VLOG(GetOwner(), LogCrowdFollowing, Log, TEXT("Last path segment finished due to \'%s\'"), bMovedTooFar ? TEXT("Missing Last Point") : TEXT("Reaching Destination")); OnPathFinished(EPathFollowingResult::Success); } } else { // override radius multiplier and switch to next path part when closer than 4x agent radius const float NextPartMultiplier = 4.0f; const bool bHasReached = HasReachedInternal(GoalLocation, 0.0f, 0.0f, CurrentLocation, 0.0f, NextPartMultiplier); if (bHasReached) { SwitchToNextPathPart(); } } } // gather location samples to detect if moving agent is blocked if (bCanReachTarget && Status == EPathFollowingStatus::Moving) { const bool bHasNewSample = UpdateBlockDetection(); if (bHasNewSample && IsBlocked()) { OnPathFinished(EPathFollowingResult::Blocked); } } }