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

Function getMasterServerList

engine/source/network/serverQuery.cc:637–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

635//-----------------------------------------------------------------------------
636
637Vector<MasterInfo>* getMasterServerList()
638{
639 // This code used to get the master server list from the
640 // WON.net directory.
641 static Vector<MasterInfo> masterList;
642 masterList.clear();
643
644 for (U32 i = 0; i < 10; i++) {
645 char buffer[50];
646 dSprintf(buffer,sizeof(buffer),"Pref::Master%d",i);
647 const char* master = Con::getVariable(buffer);
648 if (master && *master) {
649 NetAddress address;
650 // Format for master server variable:
651 // regionMask:netAddress
652 U32 region = 1; // needs to default to something > 0
653 dSscanf(master,"%d:",&region);
654 const char* madd = dStrchr(master,':') + 1;
655 if (region && Net::stringToAddress(madd,&address) == Net::NoError) {
656 masterList.increment();
657 MasterInfo& info = masterList.last();
658 info.address = address;
659 info.region = region;
660 }
661 else
662 Con::errorf("Bad master server address: %s",master);
663 }
664 }
665
666 if (!masterList.size())
667 Con::errorf("No master servers found");
668
669 return &masterList;
670}
671
672
673//-----------------------------------------------------------------------------

Callers 4

queryMasterGameTypesFunction · 0.85
queryMasterServerFunction · 0.85
sendHeartbeatFunction · 0.85

Calls 9

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

Tested by

no test coverage detected