Skip to content

Commit

Permalink
fix: fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
chenqinghe committed Oct 11, 2022
1 parent 0bc5882 commit 15034d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ require (
github.com/gorilla/websocket v1.4.2
github.com/sirupsen/logrus v1.8.1
)

require golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
8 changes: 4 additions & 4 deletions wsserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (c *WSConn) ReadPacket() (Packet, error) {
}

return WebsocketPacket{
id: atomic.AddInt32(&idGen, 1),
id: atomic.AddInt64(&idGen, 1),
ts: time.Now(),
Type: typ,
Data: data,
Expand Down Expand Up @@ -116,18 +116,18 @@ func (h *wsHandler) Handle(c *websocket.Conn) {
}

type WebsocketPacket struct {
id int32
id int64
ts time.Time
Type int
Data []byte
}

func (p WebsocketPacket) Id() int32 {
func (p WebsocketPacket) Id() int64 {
return p.id
}

func (p WebsocketPacket) Time() time.Time {
return p.ts
}

var idGen int32
var idGen int64

0 comments on commit 15034d0

Please sign in to comment.