debug(rigctld): always trace a client's first six commands

A connect that lasts 50 ms leaves nothing to say which answer the client
disliked — WSJT-X refusing to attach to the shared CAT was undiagnosable
without the full wire trace. The handshake is now always logged; steady-state
polling stays behind the trace switch.
This commit is contained in:
2026-08-30 15:55:58 +02:00
parent 3b555219d2
commit 53100eb6c8
+7 -1
View File
@@ -246,6 +246,11 @@ func (s *Server) serve(c net.Conn) {
s.releasePTT(fmt.Sprintf("client %s left", c.RemoteAddr()))
}()
s.log("rigctld: client connected from %s", c.RemoteAddr())
// The HANDSHAKE is always traced — the first few commands are where a
// client decides to stay or hang up, and a connect that lasted 50 ms left
// nothing in the log to say which answer it disliked. Steady-state polling
// stays behind the CAT trace switch.
traced := 0
r := bufio.NewReader(c)
w := bufio.NewWriter(c)
for {
@@ -265,7 +270,8 @@ func (s *Server) serve(c net.Conn) {
// that preceded it — the one thing needed to tell whether OpsLog answered
// something the client could not accept. Behind the same switch as the CAT
// wire trace: this is one line per poll and would drown an ordinary log.
if req != "" && cat.CIVTraceEnabled() {
if req != "" && (traced < 6 || cat.CIVTraceEnabled()) {
traced++
s.log("rigctld: %s → %q ⇒ %q", c.RemoteAddr(), req, strings.TrimRight(resp, "\r\n"))
}
if resp != "" {