From ce1dae373dbb48d2d3cd4f7b0ce5c5a391449e02 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Mon, 4 Apr 2022 10:18:19 -0500 Subject: [PATCH] cleaning up before first push --- doc.md => README.md | 17 ++++++----------- udp_client.onyx => example/udp_client.onyx | 0 udp_server.onyx => example/udp_server.onyx | 0 src/host.onyx | 1 + src/peer.onyx | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) rename doc.md => README.md (70%) rename udp_client.onyx => example/udp_client.onyx (100%) rename udp_server.onyx => example/udp_server.onyx (100%) diff --git a/doc.md b/README.md similarity index 70% rename from doc.md rename to README.md index 3aa18ff..afb5049 100644 --- a/doc.md +++ b/README.md @@ -9,6 +9,7 @@ each. On each socket, multiple channels are used. Each channel supports: - Sequencing - Reliable transmissions - Commands (control codes) + These are supported independent of the other channels. This enable the programmer to use sequencial packets for data that needs to arrive in order, and unsequencial / unreliable packets for things like movement @@ -19,16 +20,10 @@ practically, assume that anything over 1MB in size should probably be transferred in a different way, or chunked up by the application layer. +Currently, these features are not supported: +[ ] Bundle acknowledgement messages together. -Each packet is at most 1400 bytes in size. - -0 2 4 6 8 ... -| peerID | sentTime | checksum | channelID | commandID | data - OPTIONAL OPTIONAL - +[ ] Packets are not necessarily sequenced. A dropped packet followed + by a successful packet with be out of order. -Currently, these features are not supported: - [ ] Packets are not necessarily sequenced. A dropped packet followed - by a successful packet with be out of order. - - [x] Framemented reliable data. \ No newline at end of file +[x] Framemented reliable data. diff --git a/udp_client.onyx b/example/udp_client.onyx similarity index 100% rename from udp_client.onyx rename to example/udp_client.onyx diff --git a/udp_server.onyx b/example/udp_server.onyx similarity index 100% rename from udp_server.onyx rename to example/udp_server.onyx diff --git a/src/host.onyx b/src/host.onyx index 3ab8264..978a0b8 100644 --- a/src/host.onyx +++ b/src/host.onyx @@ -68,6 +68,7 @@ host_create :: (addr: ^net.Socket_Address, peer_count: u32) -> (^Host, Host_Crea host.current_time = ~~ (os.time() & cast(u64) 0xFFFFFFFF); for^ peer: host.peers { + memory.set(peer, 0, sizeof typeof *peer); peer.host = host; peer.state = .Disconnected; peer.channels = .{ null, 0 }; diff --git a/src/peer.onyx b/src/peer.onyx index fb3535a..e40d929 100644 --- a/src/peer.onyx +++ b/src/peer.onyx @@ -15,8 +15,8 @@ Peer_State :: enum { Peer :: struct { host: ^Host; - addr: net.Socket_Address; state: Peer_State; + addr: net.Socket_Address; channels: [] Channel; -- 2.25.1