bugfix message history

This commit is contained in:
AJ ONeal 2018-08-02 00:33:11 -06:00
parent 0f7580954e
commit a26cfccd19
1 changed files with 1 additions and 2 deletions

View File

@ -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