diff options
| author | EuAndreh <eu@euandre.org> | 2026-04-30 07:08:28 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2026-04-30 07:08:28 -0300 |
| commit | 5d7e9bc31c3fc43d9476f13474d37127924103a5 (patch) | |
| tree | eee73273c704e150946b634e10be8e4abfae06a7 /tests | |
| parent | Update to latest project skeleton: i18n and fine-grained fuzzing (diff) | |
| download | wscat-5d7e9bc31c3fc43d9476f13474d37127924103a5.tar.gz wscat-5d7e9bc31c3fc43d9476f13474d37127924103a5.tar.xz | |
src/wscat.go: Make Start a duplex multi-message relay
The previous Start ran a single NextReader/NextWriter pair and
spawned the copy goroutines after the handler had already returned,
so the deferred connection close fired immediately and at most one
WebSocket message was forwarded in either direction.
Replace it with two relays — one looping NextReader → io.Copy to
the unix socket, the other reading from the unix socket and
emitting each chunk as a discrete TextMessage frame — and have the
handler block on a 2-slot done channel until at least one side
ends. When that happens, the handler explicitly sends a Close
frame, half-closes the unix side, and waits up to 250ms for the
peer to acknowledge before defers tear down both connections, so
the WS state machine on each end reaches CLOSED instead of
deadlocking in CLOSING.
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions
