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

Function MultiPollForConnectionAccepted

Descent3/multi_connect.cpp:501–522  ·  view source on GitHub ↗

Polls for a connection message so we can finally join this game Client only

Source from the content-addressed store, hash-verified

499// Polls for a connection message so we can finally join this game
500// Client only
501void MultiPollForConnectionAccepted() {
502 float start_time;
503 int connected = 0;
504 uint8_t data[MAX_RECEIVE_SIZE];
505
506 start_time = timer_GetTime();
507
508 while ((timer_GetTime() - start_time < JOIN_POLL_TIME) && !connected) {
509 int size;
510 while ((size = nw_ReceiveReliable(NetPlayers[Player_num].reliable_socket, data, MAX_RECEIVE_SIZE)) > 0) {
511 MultiProcessBigData(data, size, &Netgame.server_address);
512
513 if (NetPlayers[Player_num].flags & NPF_CONNECTED) {
514 connected = 1;
515 }
516 }
517 }
518
519 if (!connected) {
520 mprintf(0, "Couldn't get a connection_accepted packet for some reason!\n");
521 }
522}
523
524// Gets a new connection to a new client set up
525// This does not mean the client will enter the game, just that the server

Callers 1

TryToJoinServerFunction · 0.85

Calls 2

nw_ReceiveReliableFunction · 0.85
MultiProcessBigDataFunction · 0.85

Tested by

no test coverage detected