test stuff
Some checks failed
Build and Publish / BuildAndDeployAmd64 (push) Failing after 26s
Build and Publish / BuildAndDeploy (push) Successful in 3m14s

This commit is contained in:
matst80
2024-11-12 16:27:59 +01:00
parent f0dfef59a5
commit 1c42cf0976
2 changed files with 7 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ import (
"log"
"net"
"sync"
"time"
)
type CartPacketQueue struct {
@@ -41,6 +42,7 @@ func (p *CartPacketQueue) HandleConnection(connection net.Conn) error {
defer p.RemoveListeners()
defer connection.Close()
var packet CartPacket
connection.SetReadDeadline(time.Now().Add(time.Millisecond * 200))
reader := bufio.NewReader(connection)
for {
err := ReadCartPacket(reader, &packet)
@@ -52,8 +54,8 @@ func (p *CartPacketQueue) HandleConnection(connection net.Conn) error {
return err
}
if packet.Version != CurrentPacketVersion {
log.Printf("Error receiving packet: %v\n", err)
continue
log.Printf("Incorrect version: %v\n", packet.Version)
return nil
}
if packet.DataLength == 0 {
go p.HandleData(packet.MessageType, packet.Id, CallResult{