MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getMasterServerList

Function getMasterServerList

Engine/source/app/net/serverQuery.cpp:780–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

778//-----------------------------------------------------------------------------
779
780Vector<MasterInfo>* getMasterServerList()
781{
782 // This code used to get the master server list from the
783 // WON.net directory.
784 static Vector<MasterInfo> masterList;
785 masterList.clear();
786
787 for (U32 i = 0; i < 10; i++) {
788 char buffer[50];
789 dSprintf(buffer,sizeof(buffer),"pref::Master%d",i);
790 const char* master = Con::getVariable(buffer);
791 if (master && *master) {
792 NetAddress address;
793 // Format for master server variable:
794 // regionMask:netAddress
795 U32 region = 1; // needs to default to something > 0
796 dSscanf(master,"%d:",&region);
797 const char* madd = dStrchr(master,':') + 1;
798 if (region && Net::stringToAddress(madd,&address) == Net::NoError) {
799 masterList.increment();
800 MasterInfo& info = masterList.last();
801 info.address = address;
802 info.region = region;
803 }
804 else
805 Con::errorf("Bad master server address: %s",master);
806 }
807 }
808
809 if (!masterList.size())
810 Con::errorf("No master servers found");
811
812 return &masterList;
813}
814
815
816//-----------------------------------------------------------------------------

Callers 4

queryMasterGameTypesFunction · 0.85
queryMasterServerFunction · 0.85
sendHeartbeatFunction · 0.85

Calls 9

dSprintfFunction · 0.85
getVariableFunction · 0.85
dSscanfFunction · 0.85
errorfFunction · 0.85
incrementMethod · 0.80
lastMethod · 0.80
dStrchrFunction · 0.50
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected