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

Function MultiSendConnectBail

Descent3/multi.cpp:3517–3550  ·  view source on GitHub ↗

Tells all the clients who are trying to join to piss off until the next level

Source from the content-addressed store, hash-verified

3515
3516// Tells all the clients who are trying to join to piss off until the next level
3517void MultiSendConnectBail() {
3518 uint8_t data[MAX_GAME_DATA_SIZE];
3519 int count = 0;
3520 int size_offset;
3521 bool wait_to_send = false;
3522 int i;
3523
3524 size_offset = START_DATA(MP_CONNECT_BAIL, data, &count);
3525 END_DATA(count, data, size_offset);
3526
3527 // Tell them to stop trying to join
3528 for (i = 1; i < MAX_PLAYERS; i++) {
3529 if (NetPlayers[i].flags & NPF_CONNECTED && NetPlayers[i].sequence < NETSEQ_OBJECTS) {
3530 nw_SendReliable(NetPlayers[i].reliable_socket, data, count, true);
3531 wait_to_send = true;
3532 }
3533 }
3534
3535 // Make sure these clients get this
3536 if (wait_to_send) {
3537 for (int t = 0; t < 10; t++) {
3538 nw_DoNetworkIdle();
3539 Sleep(100);
3540 }
3541 }
3542
3543 // Now disconnect them
3544 for (i = 1; i < MAX_PLAYERS; i++) {
3545 if (NetPlayers[i].flags & NPF_CONNECTED && NetPlayers[i].sequence < NETSEQ_OBJECTS) {
3546 nw_CloseSocket(&NetPlayers[i].reliable_socket);
3547 NetPlayers[i].flags &= ~NPF_CONNECTED;
3548 }
3549 }
3550}
3551// Server is telling us to bail on our connection
3552void MultiDoConnectBail() {
3553 if (Netgame.local_role != LR_CLIENT)

Callers 1

MultiSendLevelEndedFunction · 0.85

Calls 6

START_DATAFunction · 0.85
END_DATAFunction · 0.85
nw_SendReliableFunction · 0.85
nw_DoNetworkIdleFunction · 0.85
nw_CloseSocketFunction · 0.85
SleepFunction · 0.50

Tested by

no test coverage detected