Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

IpDrv.MasterServerLink


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
class MasterServerLink extends Info
	native
	transient;

// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)

struct native tMasterServerEntry
{
    var string 	Address;
    var int		Port;
};

var native const pointer LinkPtr;
var globalconfig int LANPort;
var globalconfig int LANServerPort;

var globalconfig array<tMasterServerEntry> 	MasterServerList;
var array<tMasterServerEntry> 				ActiveMasterServerList;

var int LastMSIndex; 		// Index of the last used master server


native function bool Poll( int WaitTime );

// Cheap and easy load balancing coming up here.
/*
event GetMasterServer( out string OutAddress, out int OutPort )
{
	local int Index;
	Index      = rand(MasterServerList.Length);
	OutAddress = MasterServerList[Index].Address;
	OutPort    = MasterServerList[Index].Port;
}
*/

event GetMasterServer( out string OutAddress, out int OutPort )
{
	local int Index;

	if (ActiveMasterServerList.Length==0)
	{
		for (Index=0;Index<MasterServerList.Length;Index++)
		{
			ActiveMasterServerList.Length = Index+1;
			ActiveMasterServerList[Index].Address = MasterServerList[Index].Address;
			ActiveMasterServerList[Index].Port = MasterServerList[Index].Port;
		}
	}

	Index       = rand(ActiveMasterServerList.Length);
	LastMSIndex = Index;

	OutAddress = ActiveMasterServerList[Index].Address;
	OutPort    = ActiveMasterServerList[Index].Port;
}

simulated function Tick( float Delta )
{
	Poll(0);
}

defaultproperties
{
     LANPort=11777
     LANServerPort=10777
     MasterServerList(0)=(Address="ut2004master1.epicgames.com",Port=28902)
     MasterServerList(1)=(Address="ut2004master2.epicgames.com",Port=28902)
     bAlwaysTick=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: pr 5-2-2018 12:35:50.000 - Creation time: sk 18-3-2018 09:50:12.571 - Created with UnCodeX