MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / SearchForGamesPXO

Function SearchForGamesPXO

Descent3/multi_connect.cpp:934–960  ·  view source on GitHub ↗

Fills in the passed in buffers with the info of the games that are on this subnet

Source from the content-addressed store, hash-verified

932
933// Fills in the passed in buffers with the info of the games that are on this subnet
934int SearchForGamesPXO(uint32_t ask, uint16_t port) {
935 int count = 0;
936 int size;
937 int tries = 0;
938 uint8_t data[MAX_GAME_DATA_SIZE];
939 network_address check_addr, from_addr;
940 check_addr.connection_type = NP_TCP;
941 if (ask) {
942 memcpy(&check_addr.address, &ask, 4);
943 check_addr.port = htons(port);
944
945 size = START_DATA(MP_GET_PXO_GAME_INFO, data, &count);
946 MultiAddFloat(timer_GetTime(), data, &count);
947 MultiAddInt(MULTI_VERSION, data, &count);
948 END_DATA(count, data, size);
949
950 nw_Send(&check_addr, data, count, 0);
951
952 // Num_network_games_known=0;
953 }
954
955 int packsize;
956 while (((packsize = nw_Receive(Multi_receive_buffer, &from_addr)) > 0)) {
957 MultiProcessBigData(Multi_receive_buffer, packsize, &from_addr);
958 }
959 return Num_network_games_known;
960}
961
962#define MULTI_SERVER_TIMEOUT_TIME 40
963extern bool Multi_Gamelist_changed;

Callers

nothing calls this directly

Calls 7

START_DATAFunction · 0.85
MultiAddFloatFunction · 0.85
MultiAddIntFunction · 0.85
END_DATAFunction · 0.85
nw_SendFunction · 0.85
nw_ReceiveFunction · 0.85
MultiProcessBigDataFunction · 0.85

Tested by

no test coverage detected