diff --git a/src/pc/network/network.c b/src/pc/network/network.c index 8159acc7..00d72862 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -256,7 +256,10 @@ void network_send_to(u8 localIndex, struct Packet* p) { void network_send(struct Packet* p) { // prevent errors during writing from propagating - if (p->writeError) { return; } + if (p->writeError) { + LOG_ERROR("packet has write error: %u", p->packetType); + return; + } // set the flags again packet_set_flags(p); @@ -266,6 +269,7 @@ void network_send(struct Packet* p) { if (gNetworkSystem != NULL && gNetworkSystem->requireServerBroadcast && gNetworkPlayerServer != NULL) { int i = gNetworkPlayerServer->localIndex; p->localIndex = i; + p->sent = false; network_send_to(i, p); return; } @@ -288,6 +292,7 @@ void network_send(struct Packet* p) { } p->localIndex = i; + p->sent = false; network_send_to(i, p); } } diff --git a/src/pc/network/packets/packet.c b/src/pc/network/packets/packet.c index 5bbb0c4e..18eedb02 100644 --- a/src/pc/network/packets/packet.c +++ b/src/pc/network/packets/packet.c @@ -133,7 +133,7 @@ void packet_receive(struct Packet* p) { } // check if we've already seen this packet - if (p->localIndex != 0 && p->seqId != 0 && gNetworkPlayers[p->localIndex].connected) { + if (p->localIndex != 0 && p->localIndex != UNKNOWN_LOCAL_INDEX && p->seqId != 0 && gNetworkPlayers[p->localIndex].connected) { u32 packetHash = packet_hash(p); struct NetworkPlayer* np = &gNetworkPlayers[p->localIndex]; for (int i = 0; i < MAX_RX_SEQ_IDS; i++) { @@ -164,7 +164,7 @@ void packet_receive(struct Packet* p) { packet_process(p); } } else { - LOG_INFO("packet initial read failed, packetType: %d", packetType); + LOG_ERROR("packet initial read failed, packetType: %d", packetType); } // broadcast packet