void UDPProxyCoordinator::ForwardingRequest::OrderRemainingServersToTry(void)
{
	DataStructures::Multilist<ML_ORDERED_LIST,UDPProxyCoordinator::ServerWithPing,unsigned short> swpList;
	swpList.SetSortOrder(true);
	if (sourceServerPings.GetSize()==0 && targetServerPings.GetSize()==0)
		return;

	DataStructures::DefaultIndexType idx;
	UDPProxyCoordinator::ServerWithPing swp;
	for (idx=0; idx < remainingServersToTry.GetSize(); idx++)
	{
		swp.serverAddress=remainingServersToTry[idx];
		swp.ping=0;
		if (sourceServerPings.GetSize())
			swp.ping+=(unsigned short) sourceServerPings[idx].ping;
		else
			swp.ping+=(unsigned short) DEFAULT_CLIENT_UNRESPONSIVE_PING_TIME;
		if (targetServerPings.GetSize())
			swp.ping+=(unsigned short) targetServerPings[idx].ping;
		else
			swp.ping+=(unsigned short) DEFAULT_CLIENT_UNRESPONSIVE_PING_TIME;
		swpList.Push(swp, swp.ping, _FILE_AND_LINE_);
	}
	remainingServersToTry.Clear(true, _FILE_AND_LINE_ );
	for (idx=0; idx < swpList.GetSize(); idx++)
	{
		remainingServersToTry.Push(swpList[idx].serverAddress, _FILE_AND_LINE_ );
	}
}
Пример #2
0
}

std::vector<ReplicaObject*> NetworkingManager::getReplicas(string name) {
    DataStructures::Multilist<ML_STACK, Replica3*> replicaList;
    DataStructures::DefaultIndexType index;
    replicaManager.GetReferencedReplicaList(replicaList);

    std::vector<ReplicaObject*> replicas = std::vector<ReplicaObject*>();
    try {
        for (index=0; index < replicaList.GetSize(); index++) {
            ReplicaObject * temp = ((ReplicaObject *) replicaList[index]);
            if (temp->GetName().StrCmp(RakNet::RakString(name.c_str())) == 0) replicas.push_back(temp);
        }
    }
    catch (...) { return std::vector<ReplicaObject*>();}
Пример #3
0
}

ReplicaObject* NetworkingManager::getReplica(string name, bool blocking) {
    DataStructures::Multilist<ML_STACK, Replica3*> replicaList; 
    DataStructures::DefaultIndexType index;
    replicaManager.GetReferencedReplicaList(replicaList);

    while (true) {
        try {
            for (index=0; index < replicaList.GetSize(); index++) {
                ReplicaObject * temp = ((ReplicaObject *) replicaList[index]);
                if (temp->GetName().StrCmp(RakNet::RakString(name.c_str())) == 0) return temp;
            }
        }
        catch (...) {

        }
        if (!blocking) return 0;
        this->tick();
        replicaManager.GetReferencedReplicaList(replicaList);