mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-01-07 08:01:16 +00:00
Forget all reliable packets on network shutdown
Prevents strange case where one instance of a game could connect to itself.
This commit is contained in:
parent
3a26c43d14
commit
356029abf6
3 changed files with 6 additions and 0 deletions
|
@ -177,6 +177,7 @@ void network_update(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_shutdown(void) {
|
void network_shutdown(void) {
|
||||||
|
network_forget_all_reliable();
|
||||||
if (gNetworkType == NT_NONE) { return; }
|
if (gNetworkType == NT_NONE) { return; }
|
||||||
if (gNetworkSystem == NULL) { LOG_ERROR("no network system attached"); return; }
|
if (gNetworkSystem == NULL) { LOG_ERROR("no network system attached"); return; }
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ u32 packet_hash(struct Packet* packet);
|
||||||
bool packet_check_hash(struct Packet* packet);
|
bool packet_check_hash(struct Packet* packet);
|
||||||
|
|
||||||
// packet_reliable.c
|
// packet_reliable.c
|
||||||
|
void network_forget_all_reliable(void);
|
||||||
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);
|
||||||
|
|
|
@ -33,6 +33,10 @@ static void remove_node_from_list(struct PacketLinkedList* node) {
|
||||||
free(node);
|
free(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void network_forget_all_reliable(void) {
|
||||||
|
while (head != NULL) { remove_node_from_list(head); }
|
||||||
|
}
|
||||||
|
|
||||||
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 a new issue