ludic.shop, ludic.net: nothing made per tick - the week's lists and dice reused, the net's facts from a ring, the room's watch address made once, pools and kept lists through kept_push; what runs once per host, join, room or guest says so in @alloc_ok

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:09:32 +03:00
parent f5834f8f63
commit 4b533b5ff6
18 changed files with 86 additions and 23 deletions

View file

@ -2,6 +2,7 @@
# machine's pid is what its packets say. A token picked by the host names the session.
# open a socket on `port` and take guests; false (net_why) when the port is taken
@alloc_ok("once per party hosted")
export function net_host(net_st: mut NetState, port: int, token: int) -> bool {
if net_live(net_st) { return true }
net_st.net__sock = NetSocket.open(port)
@ -18,6 +19,7 @@ export function net_host(net_st: mut NetState, port: int, token: int) -> bool {
}
# dial a host at an address; the hello (net_hello_set) goes until a welcome or a refusal
@alloc_ok("once per join")
export function net_join(net_st: mut NetState, ip: int, port: int) -> bool {
if net_live(net_st) { return false }
if not net__socket(net_st) { return false }