close connection more often
Some checks failed
Build and Publish / BuildAndDeployAmd64 (push) Failing after 28s
Build and Publish / BuildAndDeploy (push) Successful in 2m9s

This commit is contained in:
matst80
2024-11-12 16:02:58 +01:00
parent 547a82832a
commit f4698acfd5
3 changed files with 27 additions and 5 deletions

View File

@@ -26,8 +26,19 @@ func NewCartPacketQueue(connection net.Conn) *CartPacketQueue {
return queue
}
func (p *CartPacketQueue) HandleConnection(connection net.Conn) error {
func (p *CartPacketQueue) RemoveListeners() {
p.mu.Lock()
defer p.mu.Unlock()
for _, l := range p.expectedPackages {
for _, l := range *l {
close(l.Chan)
}
}
p.expectedPackages = make(map[uint32]*CartListener)
}
func (p *CartPacketQueue) HandleConnection(connection net.Conn) error {
defer p.RemoveListeners()
defer connection.Close()
var packet CartPacket
reader := bufio.NewReader(connection)