MNcdNode::TState CNcdRootNodeProxy::State() const
    {
    DLTRACEIN((""));

    // Check if the link handle has been set, which means that also
    // link data has been internalized. Root node does not contain
    // metadata so it does not need to be checked.
    // The child count is also checked because in some situations when root loading
    // is cancelled the link handle may be set, but the children are not inserted to 
    // the root child list. So, the root should have children to be in initialized mode.
    if ( LinkHandleSet() && ChildCount() > 0 )
        {
        DLTRACE(("State was initialized"));
        // If state was initialized we have to check if the state
        // has acutally expired already 
        TTime now;
        now.HomeTime();

        DLTRACE(("now time: %d", now.Int64() ));
        DLTRACE(("expired time: %d", ExpiredTime().Int64() ));

        // We can just compare the times here. Server side
        // inserts the maximum value for the expired time if the
        // protocol has set never expire value for the validity delta.
        TBool isExpired = ( now > ExpiredTime() );
        TInt err = KErrNone;
        
        if ( !isExpired ) 
            {            
            TRAP( err, isExpired = IsTransparentChildExpiredL() );
            }
            
        if ( isExpired || err != KErrNone )
            {
            DLTRACEOUT(("Expired"));
            return MNcdNode::EStateExpired;
            }
            
        DLTRACEOUT(("Initialized"));
        return MNcdNode::EStateInitialized;
        }
     else
        {
        // Node has not been initialized.
        DLTRACEOUT(("Not intialized"));
        return MNcdNode::EStateNotInitialized;
        }

    }
Beispiel #2
0
void CWeddingRoom::OnRoomStartingNofiication()
{
    WeddingRoomPlayerMap_t::iterator itr = m_mapPlayers.find(m_nGroomID);

    GameMsg_S2G_WeddingRoomStartingNofication msgNoficationToGroup;
    msgNoficationToGroup.m_nGroomID = m_nGroomID;
    msgNoficationToGroup.m_nBrideID = m_nBrideID;
    msgNoficationToGroup.m_nLine = g_nLine;
    msgNoficationToGroup.m_strLineName = g_pCirculator->GetServerName();
    msgNoficationToGroup.m_nRoomID = m_nRoomID;
    msgNoficationToGroup.m_nStartTime = (unsigned int)ExpiredTime();
    ::SendMsg2GroupServer(&msgNoficationToGroup);
}
MNcdNode::TState CNcdNodeProxy::State() const
    {
    DLTRACEIN((_L("Node namespace=%S, id=%S"), &Namespace(), &Id() ));

    // Check if the link handle has been set, which means that also
    // link data has been internalized. Also, check if the metadata 
    // exists, which means that metadata has also been internalized.
    if ( LinkHandleSet() 
         && iMetadata != NULL )
        {
        DLINFO(("State was initialized"));
        // If state was initialized we have to check if the state
        // has acutally expired already 
        TTime now;
        now.HomeTime();

        DLINFO(("now time: %d", now.Int64() ));
        DLINFO(("expired time: %d", ExpiredTime().Int64() ));

        // We can just compare the times here. Server side
        // inserts the maximum value for the expired time if the
        // protocol has set never expire value for the validity delta.
        if ( now > ExpiredTime() )
            {
            DLTRACEOUT(("Expired"));
            return MNcdNode::EStateExpired;
            }
            
        DLTRACEOUT(("Initialized"));
        return MNcdNode::EStateInitialized;
        }
     else
        {
        // Node has not been initialized.
        DLTRACEOUT(("Not initialized"));
        return MNcdNode::EStateNotInitialized;
        }
    }
TBool CNcdNodeLink::IsExpired() const
    {
    DLTRACEIN((""));

    TTime currentTime;
    currentTime.HomeTime();
    
    if ( ExpiredTime() <= currentTime )
        {
        DLTRACEOUT(( "Link is expired" ));
        return ETrue;
        }
    else
        {
        DLTRACEOUT(( "Link is not expired" ));
        return EFalse;
        } 
    }
Beispiel #5
0
int dpMain::Search(double max_time)
{
	if(!start_node)
	{
		cerr << "dpMain error: start node not set" << endl;
		return -1;
	}
	dpQueue* q = top_queue;
	LongInteger start_tick = GetTick();
	while(q)
	{
		if(q->node->open(-1, -1)) break;
		remove_node_single(q->node);
		q = smallest_queue();
		LongInteger cur_tick = GetTick();
		if(ExpiredTime(start_tick, cur_tick) > max_time) return 1;
	}
	return 0;
}
void CNcdNodeLink::ExternalizeDataForRequestL( RWriteStream& aStream ) const
    {
    DLTRACEIN((""));

    // Link existed. So, insert info that link was found.
    aStream.WriteInt32L( ClassId() );

    // Notice that the proxy does not require all the information contained
    // in this class. So, send only the information that proxy wants.

    ExternalizeDesL( Timestamp(), aStream );
    ExternalizeDesL( CatalogsSourceName(), aStream );
    aStream.WriteInt32L( RemoteFlag() );
 
    aStream << ExpiredTime().Int64();    
        
    ParentIdentifierForRequestL( aStream );
    
    // Externalize the real parent too.
    ParentIdentifier().ExternalizeL( aStream );
        
    DLTRACEOUT((""));
    }