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:
@@ -246,6 +246,11 @@ func (s *Server) serve(c net.Conn) {
|
|||||||
s.releasePTT(fmt.Sprintf("client %s left", c.RemoteAddr()))
|
s.releasePTT(fmt.Sprintf("client %s left", c.RemoteAddr()))
|
||||||
}()
|
}()
|
||||||
s.log("rigctld: client connected from %s", 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)
|
r := bufio.NewReader(c)
|
||||||
w := bufio.NewWriter(c)
|
w := bufio.NewWriter(c)
|
||||||
for {
|
for {
|
||||||
@@ -265,7 +270,8 @@ func (s *Server) serve(c net.Conn) {
|
|||||||
// that preceded it — the one thing needed to tell whether OpsLog answered
|
// 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
|
// 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.
|
// 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"))
|
s.log("rigctld: %s → %q ⇒ %q", c.RemoteAddr(), req, strings.TrimRight(resp, "\r\n"))
|
||||||
}
|
}
|
||||||
if resp != "" {
|
if resp != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user