Fix the document UI's TCP connection: five compounding bugs left it unable to serve a guest#7
Open
peacedudes wants to merge 1 commit into
Open
Fix the document UI's TCP connection: five compounding bugs left it unable to serve a guest#7peacedudes wants to merge 1 commit into
peacedudes wants to merge 1 commit into
Conversation
…, survive idle/reconnect, make Connect button and status work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The document UI's TCP (Network) connection looked functional but couldn't
actually serve a guest — five small bugs in
DriveWireTCPDriver/TCPCommsViewcompounded so that no byte ever reached the protocol host andno response ever reached the wire. Found while pointing a live NitrOS-9
system at the dashboard.
The bugs
readLoop()routed networkinput to
dataAvailable(host:data:)— the delegate output callback —which only hex-dumped it. Nothing called
host.send(data:), so theprotocol engine never saw guest traffic. Fixed: the read loop now feeds
host.send(data:)on the main queue.dataAvailableended with acommented-out serial-driver leftover (
// serialPort?.send(data)), sohost responses (DWINIT capability byte, sector data, time) were dropped.
Fixed: it now writes to the output stream via
send(data:), which alsohandles partial writes instead of ignoring the write return.
while !quit, ..., stream.hasBytesAvailablemade "no bytes pending" aloop-exit condition — with the loop started right after
connect(),it usually exited before the guest said anything. Fixed: idle now sleeps
and re-polls; only EOF/error ends the loop.
stop()latchedquit = trueforever, so any reconnect (includingthe
didSet-triggered ones) started a read loop that exitedimmediately. Fixed:
connect()clears the flag.ipAddress/ipPortand relied on theirdidSetobservers toreconnect — so clicking Connect with unchanged values did nothing
(the workaround was editing a field to force a change), and changing
both fields reconnected twice, once to a half-updated endpoint. Fixed:
a
connect(ipAddress:ipPort:)method sets both silently and connectsonce, and the button calls it.
TCPCommsViewnow also observes thedriver, so the connection status label updates when the state actually
changes rather than on the next unrelated redraw.
Verification
Live end-to-end: NitrOS-9 EOU (dw_becker) booted under XRoar, bridged to
the app's outbound TCP connection with a small localhost relay (both XRoar's
becker cart and this driver dial out, so a two-listener relay marries them).
With these fixes the dashboard answers OP_DWINIT with the capability byte,
serves OP_TIME, and the activity log and telemetry track the guest's boot
traffic in real time. Build also verified directly on this branch.
🤖 Generated with Claude Code