make it compile

This commit is contained in:
Iris Lightshard 2023-02-12 06:55:57 -07:00
parent cd14def1f8
commit 6fc78c333c
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -1,14 +1,16 @@
package gametable
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"golang.org/x/time/rate"
"hacklab.nilfm.cc/felt/admin"
"hacklab.nilfm.cc/felt/models"
"hacklab.nilfm.cc/felt/mongodb"
"hacklab.nilfm.cc/quartzgun/auth"
"hacklab.nilfm.cc/quartzgun/cookie"
"hacklab.nilfm.cc/quartzgun/renderer"
"io/ioutil"
"log"
@ -90,7 +92,7 @@ func (self *GameTableServer) subscribe(r *http.Request, c *websocket.Conn) error
err := json.NewDecoder(r.Body).Decode(&tableKey)
if err != nil {
fmt.Println(err.Error())
return
return err
}
if !self.dbAdapter.CheckTable(tableKey) {
@ -142,7 +144,7 @@ func (self *GameTableServer) publish(msg []byte) {
// decode message and store in DB
tableMsg := models.TableMessage{}
err := json.NewDecoder(msg).Decode(&tableMsg)
err := json.NewDecoder(bytes.NewReader(msg)).Decode(&tableMsg)
if err != nil {
fmt.Println(err.Error())
return
@ -153,7 +155,7 @@ func (self *GameTableServer) publish(msg []byte) {
self.publishLimiter.Wait(context.Background())
for s, k := range self.subscribers {
if k == tableMsg.tableKey {
if k == tableMsg.Key {
select {
case s.msgs <- msg:
default:
@ -163,12 +165,12 @@ func (self *GameTableServer) publish(msg []byte) {
}
}
func (self *GameTableServer) getCurrentState(tableKey models.TableKey) ([]byte, error) {
func (self *GameTableServer) getCurrentState(tableKey models.TableKey) ([]byte) {
// get diceroll log, map, and token state
// build into a []byte message
return make([]byte, 1), nil
return make([]byte, 1)
}
func (self *GameTableServer) writeToDB(tableMsg models.TableMessage) error {