From c58b4b15432b7c39d6e228353c6040ea54bb2a6a Mon Sep 17 00:00:00 2001 From: saji Date: Sat, 29 Apr 2023 17:34:35 -0500 Subject: [PATCH] cleanup and fix broker start --- cmd/server.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/server.go b/cmd/server.go index 11a8e22..2ded0a2 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -29,19 +29,13 @@ var serveCmd = &cli.Command{ }, } -type session struct { - conn net.Conn - send chan gotelem.Body - recv chan gotelem.Body - quit chan bool -} - func serve() { broker := NewBroker(3) // start the can listener go vcanTest() go canHandler(broker) + go broker.Start() ln, err := net.Listen("tcp", ":8082") if err != nil { fmt.Printf("Error listening: %v\n", err) @@ -91,7 +85,7 @@ func handleCon(conn net.Conn, broker *Broker) { case rxBody := <-rxPkts: // do nothing for now. fmt.Printf("got a body %v\n", rxBody) - case <-time.NewTimer(1 * time.Second).C: // time out. + case <-time.After(1 * time.Second): // time out. fmt.Printf("timeout\n") data := gotelem.StatusBody{ BatteryPct: 1.2,