diff --git a/chatserver.go b/chatserver.go index e860090..ed848b3 100644 --- a/chatserver.go +++ b/chatserver.go @@ -744,7 +744,6 @@ func main() { broadcastMsg = make(chan myMsg, 128) // Poor-Man's container/ring (circular buffer) myChatHist.msgs = make([]*myMsg, 128) - msgIndex := 0 var addr string if 0 != int(*port) { @@ -854,7 +853,7 @@ func main() { myHttpServer.chans <- bufConn case msg := <-broadcastMsg: // copy comes in, pointer gets saved (and not GC'd, I hope) - myChatHist.msgs[msgIndex] = &msg + myChatHist.msgs[myChatHist.i] = &msg myChatHist.i += 1 if myChatHist.c < cap(myChatHist.msgs) { myChatHist.c += 1