protocol/packet: switch away from allocation

- Packet struct is small enough that allocation for it is really unnecessary, and can be passed around by value fairly easily
This commit is contained in:
2023-03-10 20:00:06 -06:00
parent 985890d351
commit f1552830a0
4 changed files with 14 additions and 17 deletions

View File

@@ -18,7 +18,7 @@ const (
)
type PeerHandler interface {
HandlePacket(client *Peer, typeID uint32, pkt *protocol.Packet)
HandlePacket(client *Peer, typeID uint32, pkt protocol.Packet)
Connect(client *Peer)
Disconnect(client *Peer)
}
@@ -116,8 +116,6 @@ func (client *Peer) ClientHandler() {
panic(fmt.Errorf("[FATAL] failed to read packet body! %v", err))
}
fmt.Printf("%#v", buf)
// decrypt
protocol.DecryptData(buf.Bytes(), client.E_key)