Route Python local server through transport port

This commit is contained in:
Meta Vens 2026-06-16 04:11:24 +01:00
commit a7efd1ebaf
4 changed files with 26 additions and 16 deletions

View file

@ -153,8 +153,9 @@ Current progress:
path or the transport connection path.
- Python now has the same `tcp_framed` transport profile helper plus a
synchronous `TcpFramedTransportConnection` with `send`, `receive`, `close`,
and stats. `CultNetRawClient` and database subscriptions send/read through
that port instead of owning frame I/O directly.
and stats. `CultNetRawClient`, database subscriptions, and the local
CultMesh server connection loop send/read through that port instead of owning
frame I/O directly.
- Rust now has the same `tcp_framed` transport profile helper plus a
`TcpFramedTransportConnection` with schema-channel `send`, `receive`, and
transfer stats. The Rust interop peer advertises and uses that shared port
@ -243,10 +244,9 @@ Current progress:
lease catalogs, stream catalogs, and RUDP client/server construction. The
facade delegates to the same owners as the top-level helpers instead of
creating a second authority path.
- The remaining parity work is to deepen Python's server-side use of its port
and move each runtime's existing TCP/LiteNetLib/WebSocket bodies behind those
ports, then broaden RUDP interop into automatic reconnect orchestration and
the wider schema-message matrix.
- The remaining parity work is to move the remaining TCP/LiteNetLib/WebSocket
service bodies behind their shared transport ports, then broaden RUDP interop
into automatic reconnect orchestration and the wider schema-message matrix.
## RUDP Packet Contract V0

View file

@ -56,9 +56,9 @@ CultMesh.
## Remaining Work Before A Full Completion Claim
- Broaden service adoption so local servers and daemon paths use the shared
transport port consistently instead of keeping raw TCP/LiteNetLib/WebSocket
ownership in individual bodies.
- Broaden service adoption so remaining daemon and production paths use the
shared transport port consistently instead of keeping raw
TCP/LiteNetLib/WebSocket ownership in individual bodies.
- Extend RUDP interop evidence through automatic reconnect orchestration and
the wider schema-message matrix. RUDP profiles now advertise the portable
reconnect policy across the targeted runtimes; service adoption of that

View file

@ -164,8 +164,10 @@ CultCache, CultNet, and CultMesh. It is evidence, not confetti.
- Python CultMesh local server:
Serves a `CultMeshNode` plus Verse and peer catalogs over the same framed
MessagePack request/response lane used by `CultNetRawClient` and
`CultMeshDiscoveryClient`. It also supports live raw database subscriptions
for snapshot, put, and delete notifications on a connected client stream.
`CultMeshDiscoveryClient`. Accepted connections now read and write through
the shared `TcpFramedTransportConnection` port rather than owning raw frame
I/O in the server loop. It also supports live raw database subscriptions for
snapshot, put, and delete notifications on a connected client stream.
When given a `CultNetSimulationObservationHub`, it accepts
`cultnet.simulation_observation.v0` messages and replies with current
`cultnet.simulation_consensus_candidate.v0` messages through the same framed

View file

@ -9,10 +9,9 @@ import msgpack
from cultnet_py import (
CultNetSimulationObservationHub,
TcpFramedTransportConnection,
create_tcp_framed_transport_profile,
read_frame,
wire_message_schema_descriptors,
write_frame,
)
from .node import CultMeshNode
@ -142,18 +141,27 @@ class CultMeshLocalServer:
def _handle_connection(self, client: socket.socket) -> None:
with client:
stream = client.makefile("rwb")
transport = TcpFramedTransportConnection(
stream,
profile=create_tcp_framed_transport_profile(
self.node.runtime_id,
transport_id="cultmesh-local-tcp",
host=self.host,
port=self.port,
),
)
subscriptions: dict[str, _DatabaseSubscription] = {}
while not self._stop.is_set():
try:
message = msgpack.unpackb(read_frame(stream), raw=False)
frame = transport.receive()
message = msgpack.unpackb(frame.payload, raw=False)
except EOFError:
return
if not isinstance(message, dict):
continue
responses = self._handle_connection_message(message, subscriptions)
for response in responses:
write_frame(stream, msgpack.packb(response, use_bin_type=True))
stream.flush()
transport.send("schema", msgpack.packb(response, use_bin_type=True))
def _handle_connection_message(
self,