From 23702d237db172e5a4ab091fde11c69590319db1 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Tue, 12 Dec 2017 19:37:58 +0100 Subject: [PATCH] fixed wrong type of variable --- main.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index f79c91e..1753b0a 100644 --- a/main.go +++ b/main.go @@ -55,44 +55,44 @@ func check(e error) { } } -func (ledd *LedDaemon) receive() { +func (daemon *LedDaemon) receive() { for { message := make([]byte, 4096) - length, err := ledd.socket.Read(message) + length, err := daemon.socket.Read(message) if err != nil { - ledd.socket.Close() + daemon.socket.Close() break } if length > 0 { msgLen := binary.BigEndian.Uint32(message[0:3]) - log.Debugf("[%s] Read %d bytes, first protobuf is %d long", ledd.name, length, msgLen) + log.Debugf("[%s] Read %d bytes, first protobuf is %d long", daemon.name, length, msgLen) backendMsg := &ledd.BackendWrapperMessage{} err = proto.Unmarshal(message[4:msgLen], backendMsg) if err != nil { - log.Warningf("[%s] Couldn't decode protobuf msg!", ledd.name) + log.Warningf("[%s] Couldn't decode protobuf msg!", daemon.name) continue } switch msg := backendMsg.Msg.(type) { case *ledd.BackendWrapperMessage_MLedd: - ledd.name = msg.MLedd.Name + daemon.name = msg.MLedd.Name log.Infof("Connection with LedD (%s) etablished and registered", msg.MLedd.Name) } } } } -func (ledd *LedDaemon) send() { - defer ledd.socket.Close() +func (daemon *LedDaemon) send() { + defer daemon.socket.Close() for { select { - case message, ok := <-ledd.data: + case message, ok := <-daemon.data: if !ok { return } - ledd.socket.Write(message) + daemon.socket.Write(message) } } }