Drop all reliable packets that are going to someone that disconnected
This commit is contained in:
parent
b3f7e1dc0a
commit
1e7b1a7615
|
@ -313,6 +313,7 @@ u8 network_player_disconnected(u8 globalIndex) {
|
||||||
np->currLevelSyncValid = false;
|
np->currLevelSyncValid = false;
|
||||||
np->currAreaSyncValid = false;
|
np->currAreaSyncValid = false;
|
||||||
gNetworkSystem->clear_id(i);
|
gNetworkSystem->clear_id(i);
|
||||||
|
network_forget_all_reliable_from(i);
|
||||||
for (int j = 0; j < MAX_SYNC_OBJECTS; j++) { gSyncObjects[j].rxEventId[i] = 0; }
|
for (int j = 0; j < MAX_SYNC_OBJECTS; j++) { gSyncObjects[j].rxEventId[i] = 0; }
|
||||||
LOG_INFO("player disconnected, local %d, global %d", i, globalIndex);
|
LOG_INFO("player disconnected, local %d, global %d", i, globalIndex);
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,7 @@ void packet_set_ordered_data(struct Packet* packet);
|
||||||
|
|
||||||
// packet_reliable.c
|
// packet_reliable.c
|
||||||
void network_forget_all_reliable(void);
|
void network_forget_all_reliable(void);
|
||||||
|
void network_forget_all_reliable_from(u8 localIndex);
|
||||||
void network_send_ack(struct Packet* p);
|
void network_send_ack(struct Packet* p);
|
||||||
void network_receive_ack(struct Packet* p);
|
void network_receive_ack(struct Packet* p);
|
||||||
void network_remember_reliable(struct Packet* p);
|
void network_remember_reliable(struct Packet* p);
|
||||||
|
|
|
@ -38,6 +38,18 @@ void network_forget_all_reliable(void) {
|
||||||
while (head != NULL) { remove_node_from_list(head); }
|
while (head != NULL) { remove_node_from_list(head); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void network_forget_all_reliable_from(u8 localIndex) {
|
||||||
|
if (localIndex == 0) { return; }
|
||||||
|
struct PacketLinkedList* node = head;
|
||||||
|
while (node != NULL) {
|
||||||
|
struct PacketLinkedList* next = node->next;
|
||||||
|
if (node->p.localIndex == localIndex) {
|
||||||
|
remove_node_from_list(node);
|
||||||
|
}
|
||||||
|
node = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void network_send_ack(struct Packet* p) {
|
void network_send_ack(struct Packet* p) {
|
||||||
// grab seq num
|
// grab seq num
|
||||||
u16 seqId = 0;
|
u16 seqId = 0;
|
||||||
|
|
Loading…
Reference in New Issue