From 472ec3556a66530e7d2255f75ced81cbbf3a1c74 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Fri, 5 Dec 2025 18:42:57 -0800 Subject: Improve error handling, logging, and fix race condition in Disconnect - Add logging for unhandled transaction types in Client.HandleTransaction - Fix race condition in Client.Disconnect by protecting done channel with mutex - Add TranServerMsg to transaction type names map - Use Time type instead of raw byte array in File.flattenedFileObject - Improve error message in handleFileTransfer to include reference number - Simplify return statement in HandleGetFileInfo --- hotline/client.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'hotline/client.go') diff --git a/hotline/client.go b/hotline/client.go index f8d9c34..23bfe9c 100644 --- a/hotline/client.go +++ b/hotline/client.go @@ -186,15 +186,20 @@ func (c *Client) HandleTransaction(ctx context.Context, t *Transaction) error { return err } } + } else { + c.Logger.Info("Unhandled transaction", "type", tranTypeNames[t.Type], "id", int(binary.BigEndian.Uint16(t.Type[:]))) } return nil } func (c *Client) Disconnect() error { + c.mu.Lock() if c.done != nil { close(c.done) + c.done = nil } + c.mu.Unlock() return c.Connection.Close() } -- cgit