8155797

Branches > client-handling-rewrite > 8155797 > files

Update core.clj docstrings

Grahp, 2026-02-28

Commit: 8155797ad3cbc6b4e0ec2f57466d78c8ccfef673
Parent: 9f529f7

1 changed file:

src/net/bowmap/core.clj modified (view file)

@@ -11,7 +11,12 @@    [io.netty.buffer ByteBuf Unpooled]    [io.netty.channel ChannelOption])) -(defn handle-packet [client]+(defn handle-packets+  "Hands all (zero or more) unhandled Minecraft protocol packets the client has sent.+   Returns a new client.+   Packets are parsed and handled synchronously as packet decoding can update+    client state, so is impure."+  [client]   (let [{::keys [buf stream]} client]     (loop [client client]       (if (read/can-read-packet? buf)@@ -25,14 +30,13 @@         client))))  (defn handle-bytes-  "Handles a byte array of one TCP packet, splits it into Minecraft protocol packets,-    sends response packets to the client, and returns a new client.-   Packets are parsed and handled synchronously as packet decoding can update-    client state, so is impure."+  "Takes a client and a byte array of one TCP packet, and handles all+    unhandled Minecraft protocol packets in the client's buffer.+   Returns the new client state, per 'handle-packets'."   [client bs]   (try     (ByteBuf/.writeBytes (::buf client) bs)-    (handle-packet client)+    (handle-packets client)     (catch Exception e       (prn "Exception in bytes:" e)       (.close (::stream client)))))