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

Function getMasterServerList

Engine/source/app/net/serverQuery.cpp:781–814  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

queryMasterGameTypesFunction · 0.85
queryMasterServerFunction · 0.85
sendHeartbeatFunction · 0.85

Calls 9

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

Tested by

no test coverage detected