test stuff
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user