Make ping unreliable
This commit is contained in:
parent
f6f22b1629
commit
7b47eaec51
|
@ -9,7 +9,7 @@
|
||||||
#define UNKNOWN_GLOBAL_INDEX ((u8)-1)
|
#define UNKNOWN_GLOBAL_INDEX ((u8)-1)
|
||||||
#define UNKNOWN_NETWORK_INDEX ((u64)-1)
|
#define UNKNOWN_NETWORK_INDEX ((u64)-1)
|
||||||
#define NETWORK_PLAYER_TIMEOUT 10
|
#define NETWORK_PLAYER_TIMEOUT 10
|
||||||
#define NETWORK_PLAYER_PING_TIMEOUT 3
|
#define NETWORK_PLAYER_PING_TIMEOUT 1
|
||||||
#define MAX_RX_SEQ_IDS 64
|
#define MAX_RX_SEQ_IDS 64
|
||||||
#define USE_REAL_PALETTE_VAR 0xFF
|
#define USE_REAL_PALETTE_VAR 0xFF
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ void network_send_ping(struct NetworkPlayer* toNp) {
|
||||||
|
|
||||||
toNp->lastPingSent = clock_elapsed();
|
toNp->lastPingSent = clock_elapsed();
|
||||||
|
|
||||||
packet_init(&p, PACKET_PING, true, PLMT_NONE);
|
packet_init(&p, PACKET_PING, false, PLMT_NONE);
|
||||||
packet_write(&p, &toNp->globalIndex, sizeof(u8));
|
packet_write(&p, &toNp->globalIndex, sizeof(u8));
|
||||||
packet_write(&p, ×tamp, sizeof(f64));
|
packet_write(&p, ×tamp, sizeof(f64));
|
||||||
network_send_to(toNp->localIndex, &p);
|
network_send_to(toNp->localIndex, &p);
|
||||||
|
@ -27,7 +27,7 @@ void network_receive_ping(struct Packet* p) {
|
||||||
packet_read(p, ×tamp, sizeof(f64));
|
packet_read(p, ×tamp, sizeof(f64));
|
||||||
|
|
||||||
struct Packet p2 = { 0 };
|
struct Packet p2 = { 0 };
|
||||||
packet_init(&p2, PACKET_PONG, true, PLMT_NONE);
|
packet_init(&p2, PACKET_PONG, false, PLMT_NONE);
|
||||||
packet_write(&p2, &globalIndex, sizeof(u8));
|
packet_write(&p2, &globalIndex, sizeof(u8));
|
||||||
packet_write(&p2, ×tamp, sizeof(f64));
|
packet_write(&p2, ×tamp, sizeof(f64));
|
||||||
network_send_to(p->localIndex, &p2);
|
network_send_to(p->localIndex, &p2);
|
||||||
|
|
Loading…
Reference in New Issue