This commit is contained in:
@@ -12,6 +12,8 @@ type CartPacketQueue struct {
|
||||
expectedPackages map[uint32]*CartListener
|
||||
}
|
||||
|
||||
const CurrentPacketVersion = 2
|
||||
|
||||
type CartListener map[CartId]chan []byte
|
||||
|
||||
func NewCartPacketQueue(connection net.Conn) *CartPacketQueue {
|
||||
@@ -36,6 +38,14 @@ func (p *CartPacketQueue) HandleConnection(connection net.Conn) error {
|
||||
log.Printf("Error receiving packet: %v\n", err)
|
||||
return err
|
||||
}
|
||||
if packet.Version != CurrentPacketVersion {
|
||||
log.Printf("Error receiving packet: %v\n", err)
|
||||
continue
|
||||
}
|
||||
if packet.DataLength == 0 {
|
||||
go p.HandleData(packet.MessageType, packet.Id, []byte{})
|
||||
continue
|
||||
}
|
||||
data, err := GetPacketData(connection, packet.DataLength)
|
||||
if err != nil {
|
||||
log.Printf("Error receiving packet data: %v\n", err)
|
||||
|
||||
Reference in New Issue
Block a user