switch to sending temp/humidity every cb

This commit is contained in:
Travis Shears 2025-12-21 18:37:05 +01:00
parent 3f54203246
commit af4b86b966
Signed by: travisshears
GPG key ID: CB9BF1910F3F7469
2 changed files with 58 additions and 83 deletions

View file

@ -1,6 +1,7 @@
package main
import (
"io"
"log/slog"
"net"
"os"
@ -49,7 +50,11 @@ func handleConnection(conn *net.TCPConn) {
//Read up to 1024 bytes
n, err := conn.Read(buffer)
if err != nil {
slog.Error("Error reading from connection", "error", err)
if err == io.EOF {
slog.Info("Connection closed by client", "remote_addr", conn.RemoteAddr().String())
} else {
slog.Error("Error reading from connection", "error", err)
}
return
}
if n == 0 {