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

Function SearchForLocalGamesTCP

Descent3/multi_connect.cpp:905–931  ·  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

903#define GET_GAME_INFO_TIME 2
904// Fills in the passed in buffers with the info of the games that are on this subnet
905int SearchForLocalGamesTCP(uint32_t ask, uint16_t port) {
906 int count = 0;
907 int size;
908 int tries = 0;
909 uint8_t data[MAX_GAME_DATA_SIZE];
910 network_address check_addr, from_addr;
911 check_addr.connection_type = NP_TCP;
912 if (ask) {
913 memcpy(&check_addr.address, &ask, 4);
914 check_addr.port = htons(port);
915
916 size = START_DATA(MP_GET_GAME_INFO, data, &count);
917 MultiAddFloat(timer_GetTime(), data, &count);
918 MultiAddInt(MULTI_VERSION, data, &count);
919 END_DATA(count, data, size);
920
921 nw_Send(&check_addr, data, count, 0);
922
923 // Num_network_games_known=0;
924 }
925
926 int packsize;
927 while (((packsize = nw_Receive(Multi_receive_buffer, &from_addr)) > 0)) {
928 MultiProcessBigData(Multi_receive_buffer, packsize, &from_addr);
929 }
930 return Num_network_games_known;
931}
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) {

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