mirror repo of https://github.com/littlequartz/clink. a socket programming assignment for Sistem Terdistribusi
Client: - Keep a persistent bufio.Reader on the connection (model.reader) - On connect, initialize reader and drain initial greetings with deadlines - Pass reader into fetchMenuCmd, submitOrderCmd, and listenForBroadcastsCmd - Avoid starting duplicate broadcast listeners with broadcastListening flag - Start broadcast listener after menu is loaded and form is initialized - Update commands to read via shared reader instead of creating new ones - Remove greeting drain from connectCmd (now handled on connectedMsg) - Minor: small flow tweaks for opening form and handling reconnection Benefits: - Prevents interleaved reads from multiple readers on the same net.Conn - Reduces race conditions and broken protocol reads - Ensures a single, continuous read loop for broadcasts and responses |
||
|---|---|---|
| .github/workflows | ||
| .gitignore | ||
| AGENTS.md | ||
| build.sh | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| server.go | ||