コード例 #1
0
// called by session when session is closed.
void CRemConBulkServer::ClientClosed(CRemConBulkSession& aSession)
	{
	LOG_FUNC;
	LOG1(_L8("\t&aSession = 0x%08x"), &aSession);
	LOGSESSIONS;

	// Find this session in the array and remove it (if it's there).
	const TUint sessCount = iSessions.Count();
	for(TUint ix = 0; ix < sessCount; ++ix)
		{
		if(iSessions[ix] == &aSession)
			{
			// We've found the session in our array.
			ASSERT_DEBUG(aSession.Id() != KNullClientId);
			ASSERT_DEBUG(iBulkBearerInterface);
			iBulkBearerInterface->BulkClientRemoved(aSession.Id());
			// Remove the session from our array.
			iSessions.Remove(ix);
			break;
			}
		}

	StartShutdownTimerIfNoSessions();

	LOGSESSIONS;
	}
コード例 #2
0
ClientStage::ClientStage(const Stage& stage,const STRING gameObjectName):Stage(stage, gameObjectName)
{
    PlayerMap tempPlayerMap = this->m_PlayerMap;
    MonsterMap tempMonsterMap = this->m_MonsterMap;
    
    this->m_PlayerMap.clear();
    this->m_MonsterMap.clear();
    
    std::for_each(tempPlayerMap.begin(), tempPlayerMap.end(), [this,&stage](PlayerMap::value_type& playerInfoPair){
        Player* player = playerInfoPair.second;
        
        ASSERT_DEBUG(player != nullptr);
        
        ClientPlayer* clientPlayer = new ClientPlayer(*player);
        
        this->AddPlayer(clientPlayer->GetActorID(), clientPlayer);
       
        delete player;
    });
    tempPlayerMap.clear();
    
    // NOTE : replacing Monster object to ClientMonster object
    std::for_each(tempMonsterMap.begin(), tempMonsterMap.end(), [this](MonsterMap::value_type& monsterInfoPair){
        Monster* monster = monsterInfoPair.second;
        
        ASSERT_DEBUG(monster != nullptr);
        
        ClientMonster* clientMonster = new ClientMonster(*monster);
        this->AddMonster(clientMonster->GetActorID(), clientMonster);
        
        delete monster;
    });
    tempMonsterMap.clear();
}
コード例 #3
0
ファイル: abc.c プロジェクト: JamesLinus/vsta
/*
 * age_buf()
 *	Find the next available buf header, flush and free it
 *
 * Since this is basically a paging algorithm, it can become arbitrarily
 * complex.  The algorithm here tries to be simple, yet somewhat fair.
 */
static void
age_buf(void)
{
	struct llist *l;
	struct buf *b;

	/*
	 * Pick the oldest buf which isn't locked.
	 */
	for (l = allbufs.l_back; l != &allbufs; l = l->l_back) {
		/*
		 * Only skip if wired or active
		 */
		b = l->l_data;
		if (b->b_locks || BUSY(b)) {
			continue;
		}

		ASSERT_DEBUG(b->b_lock == 0, "age_buf: lock");
		if (!(b->b_flags & B_DIRTY)) {
			/*
			 * Remove from list, update data structures
			 */
			free_buf(b);
			return;
		}

		/*
		 * Sync out data in background
		 */
		qio(b, Q_FLUSHBUF);
	}
	ASSERT_DEBUG(bufsize <= coresec, "age_buf: buffers too large");
}
コード例 #4
0
void ActorLayer::ActorAttack(flownet::ActorID attackerActorID, flownet::ActorID targetActorID)
{
    Actor* actor = GameClient::Instance().GetClientStage()->FindActor(attackerActorID);
    ActorNode* attackingObject = this->FindActorNode(attackerActorID);
    ActorNode* targetObject = this->FindActorNode(targetActorID);
    
    if(!actor)
    {
        return;
    }
    
    ASSERT_DEBUG(attackingObject);
    ASSERT_DEBUG(targetObject);
    
    if( !actor->IsAlive() )
    {
        CCLOG("ActorLayer::ActorAttack >> ignore actor's attack request. actor is dead");
        return;
    }

    ASSERT_DEBUG(actor->GetAttackSpeed() != 0);

    float attackDuration = 1 / actor->GetAttackSpeed();

    attackingObject->StopAnimationActions();
    this->UpdateActorLookingDirection(actor, attackingObject->getPosition(), targetObject->getPosition());
    CCFiniteTimeAction* animateAttack = CCCallFunc::create(attackingObject, callfunc_selector(ActorNode::AnimateAttacking));
    CCFiniteTimeAction* timeDuration = CCDelayTime::create(attackDuration);
    CCFiniteTimeAction* animateIdle = CCCallFunc::create(attackingObject, callfunc_selector(ActorNode::AnimateIdle));
    CCFiniteTimeAction* changeToIdleState = CCCallFuncN::create(this, callfuncN_selector(ActorLayer::ChangeActorStateToIdle));
    CCAction* sequence = CCSequence::create(animateAttack, timeDuration, animateIdle, changeToIdleState, NULL);
    sequence->setTag(ActionType_Animation);
    attackingObject->runAction(sequence);
}
コード例 #5
0
void ActorLayer::MoveActor(flownet::ActorID actorID, flownet::POINT currentPosition, flownet::POINT destinationPosition)
{
    Actor* actor = GameClient::Instance().GetClientStage()->FindActor(actorID);
    ASSERT_DEBUG(actor);
    ActorNode* movingObject = this->FindActorNode(actorID);
    ASSERT_DEBUG(movingObject);
    
    if( !actor->IsAlive() )
    {
        CCLOG("ActorLayer::MoveActor >> ignore actor move request. actor is dead");
        return;
    }
    
    float distance = destinationPosition.DistanceTo(currentPosition); // NOTE : using cocos2d object point because of distance is a bit diffence with server's
    
    ASSERT_DEBUG(actor->GetMovingSpeed() != 0);
    float duration = distance / actor->GetMovingSpeed();
    
    this->UpdateActorLookingDirection(actor, movingObject->getPosition(), PointConverter::Convert(destinationPosition));
    movingObject->StopAnimationActions();
    
    CCFiniteTimeAction* animateMove = CCCallFunc::create(movingObject, callfunc_selector(ActorNode::AnimateMoving));
    CCFiniteTimeAction* actionMove = CCMoveTo::create(duration, PointConverter::Convert(destinationPosition));
    CCFiniteTimeAction* actionMoveDone = CCCallFunc::create( movingObject, callfunc_selector(ActorNode::AnimateIdle));
    CCFiniteTimeAction* changeToIdleState = CCCallFuncN::create(this, callfuncN_selector(ActorLayer::ChangeActorStateToIdle));
    CCAction* sequence = CCSequence::create(animateMove, actionMove, actionMoveDone, changeToIdleState, NULL);
    
    // TO DO : show moving point
    sequence->setTag(ActionType_Animation);
    movingObject->runAction(sequence);
}
コード例 #6
0
void ActorLayer::TeleportActor(flownet::ActorID actorID, flownet::POINT currentPosition, flownet::POINT destinationPosition)
{
    Actor* actor = GameClient::Instance().GetClientStage()->FindActor(actorID);
    ASSERT_DEBUG(actor);
    ActorNode* movingObject = this->FindActorNode(actorID);
    ASSERT_DEBUG(movingObject);
    
    if( !actor->IsAlive() )
    {
        CCLOG("ActorLayer::MoveActor >> ignore actor move request. actor is dead");
        return;
    }
    
    this->UpdateActorLookingDirection(actor, movingObject->getPosition(), PointConverter::Convert(destinationPosition));
    movingObject->StopAnimationActions();
    
    // NOTE : 자신한테 텔레포트 이펙트를 붙인채 싱크에 맞춰 이동할 수 있도록 한다
    // NOTE : teleport effect node는 자동 소멸 할 수 있도록 플래그를 켠다
    SpellEffectNode* effectNode = SpellEffectNode::create(actorID, SpellEffectType_Teleport);
    this->addChild(effectNode);
    
    CCFiniteTimeAction* animateMove = CCCallFunc::create(movingObject, callfunc_selector(ActorNode::AnimateMoving));
    CCDelayTime* beforeDelay = CCDelayTime::create(0.1);
    CCFiniteTimeAction* actionMove = CCMoveTo::create(0, PointConverter::Convert(destinationPosition));
    CCDelayTime* afterDelay = CCDelayTime::create(0.1);
    CCFiniteTimeAction* actionMoveDone = CCCallFunc::create( movingObject, callfunc_selector(ActorNode::AnimateIdle));
    CCFiniteTimeAction* changeToIdleState = CCCallFuncN::create(this, callfuncN_selector(ActorLayer::ChangeActorStateToIdle));
    CCAction* sequence = CCSequence::create(animateMove, beforeDelay, actionMove, afterDelay, actionMoveDone, changeToIdleState, NULL);
    
    // TO DO : show moving point
    sequence->setTag(ActionType_Animation);
    movingObject->runAction(sequence);
}
コード例 #7
0
ファイル: filectrl.c プロジェクト: JamesLinus/vsta
/*
 * ino_deref()
 *	Bump reference down on inode object
 */
void
ino_deref(struct inode *i)
{
	ASSERT_DEBUG(i != NULL, "bfs: ino_ref: null inode");
	ASSERT_DEBUG(i->i_refs != 0, "bfs ino_deref: wrapped");
	i->i_refs--;
}
コード例 #8
0
ファイル: abc.c プロジェクト: JamesLinus/vsta
/*
 * exec_qio()
 *	Do the actions specified by a qio operation
 */
static void
exec_qio(struct buf *b, int op)
{
	ASSERT_DEBUG(BUSY(b), "exec_qio: !busy");
	switch (op) {
	case Q_FILLBUF:
		if (b->b_flags & B_SEC0) {
			read_secs(b->b_start + 1,
				(char *)b->b_data + SECSZ,
				b->b_nsec - 1);
		} else {
			read_secs(b->b_start,
				b->b_data, b->b_nsec);
		}
		b->b_flags |= (B_SEC0|B_SECS);
		break;

	case Q_FLUSHBUF:
		_sync_buf(b, 1);
		break;

	default:
		ASSERT_DEBUG(0, "bg_thread: qio");
		break;
	}
	ASSERT_DEBUG(BUSY(b), "exec_qio: went !busy");
}
コード例 #9
0
void ScheduledTickQueue::AddTickAt(const ServerTime& serverTimePoint, ScheduledTick* scheduledTick)
{
    ASSERT_DEBUG(scheduledTick!=nullptr);
    ASSERT_DEBUG(scheduledTick->GetScheduledTime() == milliseconds(0) );
    
    scheduledTick->SetScheduledTime(serverTimePoint);
    
    m_Queue.push(scheduledTick);
}
コード例 #10
0
void ScheduledTickQueue::AddTickAfter(const milliseconds& timeDelay, ScheduledTick* scheduledTick)
{
    ASSERT_DEBUG(scheduledTick!=nullptr);
    ASSERT_DEBUG(scheduledTick->GetScheduledTime() == milliseconds(0) );
    
    const ServerTime scheduledTime = m_SharedTimer.Check()+timeDelay;
    scheduledTick->SetScheduledTime(scheduledTime);

    m_Queue.push(scheduledTick);
}
コード例 #11
0
ファイル: filectrl.c プロジェクト: JamesLinus/vsta
/*
 * ino_clear()
 *	Indicate that an inode is no longer needed and can be cleared down.
 *
 * Before we erase anything we check that the inode is not in use elsewhere
 * as we'd like to keep it if it is still needed :-)  We shouldn't have
 * any blocks allocated to the inode when we get here - they should have
 * already been "blk_trunc"'d!
 */
void
ino_clear(struct inode *i)
{
	ASSERT_DEBUG(i->i_num != ROOTINODE, "bfs ino_clear: root inode");
	ASSERT_DEBUG(i->i_prev == I_FREE, "bfs: ino_clear: i_prev used");
	ASSERT_DEBUG(i->i_next == I_FREE, "bfs: ino_clear: i_next used");

	if (i->i_refs > 0)
		return;

	ilist[i->i_num] = NULL;
	free(i);
}
コード例 #12
0
ファイル: abc.c プロジェクト: JamesLinus/vsta
/*
 * free_buf()
 *	Release buffer storage, remove from hash
 */
static void
free_buf(struct buf *b)
{
	ASSERT_DEBUG(b->b_list, "free_buf: null b_list");
	ASSERT_DEBUG(b->b_locks == 0, "free_buf: locks");
	ll_delete(b->b_list);
	(void)hash_delete(bufpool, b->b_start);
	bufsize -= b->b_nsec;
	ASSERT_DEBUG(b->b_data, "free_buf: null b_data");
	free(b->b_data);
	if (b->b_handles) {
		free(b->b_handles);
	}
	free(b);
}
コード例 #13
0
EXPORT_C void CSdpAttrIdMatchList::__DbgTestInvariant() const
	{
#ifdef _DEBUG
	TInt count = iList->Count();
	for (TInt i = 0; i < count; ++i)
		{
		TAttrRange& range = iList->At(i);
		ASSERT_DEBUG(range.iStart <= range.iEnd);
		if (i < count - 1)
			{
			ASSERT_DEBUG(range.iEnd + 1 < iList->At(i+1).iStart);
			}
		}
#endif
	}
コード例 #14
0
ファイル: rmap.c プロジェクト: JamesLinus/vsta
/*
 * makespace()
 *	Insert room for a new slot at the given position
 *
 * Returns 1 if there isn't room to insert the element, 0 on success.
 */
static int
makespace(struct rmap *rmap, struct rmap *r)
{
	struct rmap *rlim = &rmap[rmap->r_off];

	/*
	 * If no room to insert slot, return failure
	 */
	if (rmap->r_size == rmap->r_off) {
		return(1);
	}
	rmap->r_off += 1;

	/*
	 * If inserting in middle, slide up entries
	 */
	if (r <= rlim) {
		bcopy(r, r+1, sizeof(struct rmap) * ((rlim-r)+1));
		return(0);
	}

	/*
	 * Otherwise it's added at the end
	 */
	ASSERT_DEBUG(r == rlim+1, "rmap makespace: invalid insert");
	return(0);
}
コード例 #15
0
ファイル: pset_fod.c プロジェクト: JamesLinus/vsta
/*
 * fod_fillslot()
 *	Fill pset slot from a port
 */
static int
fod_fillslot(struct pset *ps, struct perpage *pp, uint idx)
{
	uint pg;

	ASSERT_DEBUG(!(pp->pp_flags & (PP_V|PP_BAD)),
		"fod_fillslot: valid");
	pg = alloc_page();
	set_core(pg, ps, idx);
	if (pageio(pg, ps->p_data, ptob(idx+ps->p_off),
			NBPG, FS_ABSREAD)) {
		free_page(pg);
		return(1);
	}

	/*
	 * Fill in the new page's value, leave one reference for
	 * our caller, and another for our cache atl
	 */
	pp->pp_flags |= PP_V;
	pp->pp_refs = 2;
	pp->pp_flags &= ~(PP_M|PP_R);
	pp->pp_pfn = pg;

	/*
	 * Add the cache reference
	 */
	add_atl(pp, ps, idx, ATL_CACHE);

	return(0);
}
コード例 #16
0
ファイル: rmap.c プロジェクト: JamesLinus/vsta
/*
 * rmap_alloc()
 *	Allocate some space from a resource map
 *
 * Returns 0 on failure.  Thus, you can't store index 0 in a resource map
 */
uint
rmap_alloc(struct rmap *rmap, uint size)
{
	struct rmap *r, *rlim;
	uint idx;

	ASSERT_DEBUG(size > 0, "rmap_alloc: zero size");
	/*
	 * Find first slot with a fit, return failure if we run
	 * off the end of the list without finding a fit.
	 */
	rlim = &rmap[rmap->r_off];
	for (r = &rmap[1]; r <= rlim; ++r) {
		if (r->r_size >= size)
			break;
	}
	if (r > rlim) {
		return(0);
	}

	/*
	 * Trim the resource element if it still has some left,
	 * otherwise delete from the list.
	 */
	idx = r->r_off;
	if (r->r_size > size) {
		r->r_off += size;
		r->r_size -= size;
	} else {
		collapse(rmap, r);
	}
	return(idx);
}
コード例 #17
0
void StageMapLayer::UpdateMyPlayer(float delta)
{
    const CCSize winSize = CCDirector::sharedDirector()->getWinSize();

    m_LastUpdatedMyPlayerPosition = m_MyPlayer->getPosition();
    
    const float mapHeight = -(m_LastUpdatedMapPosition.y/*-winSize.height*0.4f*/);
    const float turningInDistance = winSize.height*1.f;
    const float maxScale = 1.35f;
    
    { // Update Player Position and Scale
        const float playerOffset = fabs(m_MyPlayer->getPositionY()-mapHeight);
        float playerScale = maxScale;
        if( playerOffset >= turningInDistance )
        {
            playerScale = 0.f;
        }
        else
        {
            playerScale = maxScale - (playerOffset/turningInDistance);
        }
        m_MyPlayer->setScale(playerScale);
        
        if( m_SelectedStageMapPointIndex >=0 && m_SelectedStageMapPointIndex <m_StageMapPointList.size() )
        {
            this->MoveMyPlayerToSelectedIndex(delta);
        }
        else
        {
            ASSERT_DEBUG(false);
        }
    }
}
コード例 #18
0
ファイル: pset_fod.c プロジェクト: JamesLinus/vsta
/*
 * fod_writeslot()
 *	Write pset slot out to its underlying port
 *
 * We don't have coherent mapped files, so extremely unclear what
 * this condition would mean.  Panic for now.
 */
static int
fod_writeslot(struct pset *ps, struct perpage *pp, uint idx, voidfun iodone)
{
	ASSERT_DEBUG(pp->pp_flags & PP_V, "fod_writeslot: invalid");
	ASSERT(!(pp->pp_flags & PP_M), "fod_writeslot: dirty file");
	return(0);
}
コード例 #19
0
void ActorLayer::ActorEndCast(flownet::ActorID invokerActorID, flownet::SpellType spellType, flownet::POINT destination)
{
    Actor* actor = GameClient::Instance().GetClientStage()->FindActor(invokerActorID);
    ActorNode* invokerObject = this->FindPlayerNode(invokerActorID);
    
    SpellInfo spellInfo = SpellDictionary::Instance().FindSpellInfoBySpellType(spellType);
    
    if(!actor)
    {
        ASSERT_DEBUG(actor);
        return;
    }
    
    if( !actor->IsAlive() )
    {
        CCLOG("ActorLayer::ActorEndCast >> ignore fire spell request. player is dead");
        return;
    }
    
    this->UpdateActorLookingDirection(actor, invokerObject->getPosition(), PointConverter::Convert(destination));
    invokerObject->StopAnimationActions();
    CCFiniteTimeAction* animateFire = CCCallFunc::create(invokerObject, callfunc_selector(ActorNode::AnimateFire));
    CCFiniteTimeAction* timeDuration = CCDelayTime::create(Player_Fire_Duration);
    CCFiniteTimeAction* animateFireDone = CCCallFunc::create(invokerObject, callfunc_selector(ActorNode::AnimateIdle));
    CCAction* sequence = CCSequence::create(animateFire, timeDuration, animateFireDone, NULL);
    sequence->setTag(ActionType_Animation);
    invokerObject->runAction(sequence);
    
    
    this->RemoveSpellGuideLine(invokerActorID);
    
    this->FireSpell(invokerActorID, destination, spellInfo);
}
コード例 #20
0
void ActorLayer::AddNewNPC(flownet::NPC npc)
{
    ActorNodeSet* actorNodeSet = ActorNodeSet::create(npc.GetActorID());
    actorNodeSet->retain();
    actorNodeSet->AddShadowNode(npc.GetActorID());
    actorNodeSet->AddHighlightNode(npc.GetActorID());
    
    actorNodeSet->m_ActorNode->setPosition(PointConverter::Convert(npc.GetCurrentPosition()));
    
    ActorNodeSetMap::iterator iter = this->m_ActorNodeSetMap.find(npc.GetActorID());
    
    ASSERT_DEBUG(iter == this->m_ActorNodeSetMap.end());
    
    if(actorNodeSet->m_ActorNode)
    {
        this->addChild(actorNodeSet->m_ActorNode);
        actorNodeSet->m_ActorNode->InitializeAnimation();
    }
    if(actorNodeSet->m_HUDNode) this->addChild(actorNodeSet->m_HUDNode);
    if(actorNodeSet->m_ShadowNode) this->addChild(actorNodeSet->m_ShadowNode);
    if(actorNodeSet->m_HighlightNode) this->addChild(actorNodeSet->m_HighlightNode);
    if(actorNodeSet->m_ChatBalloonNode) this->addChild(actorNodeSet->m_ChatBalloonNode);
    
    this->m_ActorNodeSetMap.insert(ActorNodeSetMap::value_type(npc.GetActorID(), actorNodeSet));
}
コード例 #21
0
void CBulkReceiver::Receive()
	{
	LOG_FUNC
	ASSERT_DEBUG(iRemConBulk);
	iRemConBulk->Receive(iStatus, iInterfaceUid, iOperationId, iData);
	SetActive();
	}
コード例 #22
0
// ---------------------------------------------------------------------------
// From class CUsbClassControllerPlugIn.
// Called by UsbMan to stop this class.
// ---------------------------------------------------------------------------
//
void CUsbObexClassController::Stop(TRequestStatus& aStatus)
  {

  LOG_FUNC
  LOG1("CUsbObexClassController::Stop iState = %d", iState);
  
  //Stop() should never be called if stopping or starting (or in state EUsbServiceFatalError)
  ASSERT_DEBUG(iState == EUsbServiceStarted || iState == EUsbServiceIdle, EBadApiCallStop );

  //state may be idle after Cancel
  if ( iState == EUsbServiceIdle )
    {
    TRequestStatus* status = &aStatus;
    User::RequestComplete(status, KErrNone);
    }
  else
    {
    // Stop OBEX SM
    iRequestStatus = &aStatus;
    iState = EUsbServiceStopping;   
    aStatus = KRequestPending;
    LOG("CUsbObexClassController::Stop() calling ManageUSBService(EFalse)"); 
    iObexSM->ManageUSBServices(EFalse, iStatus);
    SetActive();
    }
  }
コード例 #23
0
ファイル: abc.c プロジェクト: JamesLinus/vsta
/*
 * _sync_buf()
 *	Sync back buffer if dirty
 *
 * Write back the 1st sector, or the whole buffer, as appropriate
 */
static void
_sync_buf(struct buf *b, int from_qio)
{
	ASSERT_DEBUG(b->b_flags & (B_SEC0 | B_SECS), "sync_buf: not ref'ed");

	/*
	 * Skip it if not dirty
	 */
	if (!(b->b_flags & B_DIRTY)) {
		return;
	}

	/*
	 * Do the I/O--whole buffer, or just 1st sector if that was
	 * the only sector referenced.
	 */
	if (!from_qio) {
		get(b);
	}
	if (b->b_flags & B_SECS) {
		write_secs(b->b_start, b->b_data, b->b_nsec);
	} else {
		write_secs(b->b_start, b->b_data, 1);
	}
	p_lock(&b->b_lock);
	b->b_flags &= ~B_DIRTY;
	v_lock(&b->b_lock);

	/*
	 * If there are possible handles, clear them too
	 */
	if (b->b_handles) {
		bzero(b->b_handles, b->b_nhandle * sizeof(void *));
	}
}
コード例 #24
0
ファイル: abc.c プロジェクト: JamesLinus/vsta
/*
 * init_buf()
 *	Initialize the buffering system
 */
void
init_buf(port_t arg_ioport, int arg_coresec)
{
	char *p;

	/*
	 * Record args
	 */
	ioport = arg_ioport;
	coresec = arg_coresec;

	/*
	 * Initialize data structures
	 */
	ll_init(&allbufs);
	bufpool = hash_alloc(coresec / 8);
	bufsize = 0;
	ASSERT_DEBUG(bufpool, "init_buf: bufpool");
	fg_pid = gettid();

	/*
	 * Record whether DMA is supported
	 */
	p = rstat(ioport, "dma");
	can_dma = p && atoi(p);

	/*
	 * Spin off background thread
	 */
	bg_pid = tfork(bg_thread, 0);
}
コード例 #25
0
void ActorLayer::MessageReceived(flownet::ActorID senderID, flownet::STRING message)
{
    ActorNodeSet* actorNodeSet = this->FindActorNodeSet(senderID);
    ASSERT_DEBUG(actorNodeSet->m_ChatBalloonNode);
    
    actorNodeSet->m_ChatBalloonNode->ChangeMessage(message);
}
コード例 #26
0
void CRemConBulkServer::StartShutdownTimerIfNoSessions()
	{
	LOG_FUNC;

	if ( iSessions.Count() == 0 )
		{
		LOG(_L8("\tno remaining sessions- starting shutdown timer"));
		// Should have been created during our construction.
		ASSERT_DEBUG(iShutdownTimer);
		// Start the shutdown timer. It's actually a CPeriodic- the first 
		// event will be in KShutdownDelay microseconds' time.
		// NB The shutdown timer might already be active, in the following 
		// case: this function is being called by NewSessionL because there 
		// was a failure creating a new session, BUT this function had already 
		// been called by the session's destructor (i.e. the failure was in 
		// the session's ConstructL, NOT its new(ELeave)). To protect against 
		// KERN-EXEC 15 just check for if the timer is already active. 
		if ( !iShutdownTimer->IsActive() )
			{
			iShutdownTimer->Start(KShutdownDelay, 
				// Delay of subsequent firings (will not happen because we kill 
				// ourselves after the first).
				0, 
				TCallBack(CRemConBulkServer::TimerFired, this)
				);
			}
		else
			{
			LOG(_L8("\tshutdown timer was already active"));
			}
		}
	}
コード例 #27
0
ファイル: Stash.cpp プロジェクト: Sinhyub/GameShared
Item* Stash::FindItem(const ItemGroup itemGroup, const ItemID itemID) const
{
    ScopedLock lockForSerialize(m_LockForSerialize);

    Item* theItem = nullptr;
    
    if( itemGroup <= ItemGroup_None || itemGroup >= ItemGroup_Max )
    {
        ASSERT_DEBUG(! (itemGroup <= ItemGroup_None || itemGroup >= ItemGroup_Max) );
        return nullptr;
    }
    
    const ItemList& itemList = m_ItemList[itemGroup];
    ItemList::const_iterator iter = std::find_if(itemList.begin() , itemList.end(), [itemID](Item* item)->bool
        {
            if( item->GetItemID() == itemID )
            {
                return true;
            }
            return false;
        });
    
    if( iter == itemList.end() )
    {
        theItem = nullptr;
    }
    else
    {
        theItem = *iter;
    }
    
    return theItem;
}
コード例 #28
0
ファイル: Stash.cpp プロジェクト: Sinhyub/GameShared
void Stash::DeleteAndRemoveItem(const ItemID itemID)
{
    ScopedLock lockForSerialize(m_LockForSerialize);
    
    BOOL result = false;
    for( INT i = 0; i< ItemGroup_Max; ++i )
    {
        ItemList& itemList = m_ItemList[i];
        ItemList::iterator iter = std::find_if(itemList.begin() , itemList.end(), [itemID](Item* item)->bool
            {
                if( item->GetItemID() == itemID )
                {
                    return true;
                }
                return false;
            });
        if( iter != itemList.end() )
        {
            Item* item = *iter;
            itemList.erase(iter);
            result = true;
            delete item;
            break;
        }
    }
    
    if( result == false )
    {
        ASSERT_DEBUG(result == true);
    }
}
コード例 #29
0
ファイル: abc.c プロジェクト: JamesLinus/vsta
/*
 * index_buf()
 *	Get a pointer to a run of data under a particular buf entry
 *
 * As a side effect, move us to front of list to make us relatively
 * undesirable for aging.
 */
void *
index_buf(struct buf *b, uint index, uint nsec)
{
	ASSERT_DEBUG((index+nsec) <= b->b_nsec, "index_buf: too far");

	get(b);
	ll_movehead(&allbufs, b->b_list);
	if ((index == 0) && (nsec == 1)) {
		/*
		 * Only looking at 1st sector.  See about reading
		 * only 1st sector, if we don't yet have it.
		 */
		if ((b->b_flags & B_SEC0) == 0) {
			/*
			 * Load the sector, mark it as present
			 */
			read_secs(b->b_start, b->b_data, 1);
			b->b_flags |= B_SEC0;
		}
	} else if ((b->b_flags & B_SECS) == 0) {
		/*
		 * Otherwise if we don't have the whole buffer, get
		 * it now.  Don't read in sector 0 if we already
		 * have it.
		 */
		if (b->b_flags & B_SEC0) {
			read_secs(b->b_start + 1, (char *)b->b_data + SECSZ,
				b->b_nsec - 1);
		} else {
			read_secs(b->b_start, b->b_data, b->b_nsec);
		}
		b->b_flags |= (B_SEC0|B_SECS);
	}
	return((char *)b->b_data + stob(index));
}
コード例 #30
0
ファイル: Stash.cpp プロジェクト: Sinhyub/GameShared
const ItemList& Stash::GetItemList(ItemGroup itemGroup) const
{
    if(itemGroup >= ItemGroup_Max || itemGroup <= ItemGroup_None)
    {
        ASSERT_DEBUG(!(itemGroup >= ItemGroup_Max || itemGroup <= ItemGroup_None));
    }
    return this->m_ItemList[itemGroup];
}