major refactoring :/
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m56s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m56s
This commit is contained in:
@@ -30,18 +30,23 @@ func NewPacketQueue(connection net.Conn) *PacketQueue {
|
||||
}
|
||||
go func() {
|
||||
defer connection.Close()
|
||||
var packet Packet
|
||||
for {
|
||||
messageType, data, err := ReceivePacket(queue.connection)
|
||||
err := ReadPacket(queue.connection, &packet)
|
||||
ts := time.Now()
|
||||
if err != nil {
|
||||
log.Printf("Error receiving packet: %v\n", err)
|
||||
|
||||
if err == io.EOF {
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Error receiving packet: %v\n", err)
|
||||
//return
|
||||
}
|
||||
|
||||
data, err := GetPacketData(queue.connection, int(packet.DataLength))
|
||||
if err != nil {
|
||||
log.Printf("Error receiving packet data: %v\n", err)
|
||||
return
|
||||
}
|
||||
queue.mu.Lock()
|
||||
|
||||
l := make([]PacketWithData, 0, len(queue.Packets))
|
||||
@@ -53,7 +58,7 @@ func NewPacketQueue(connection net.Conn) *PacketQueue {
|
||||
}
|
||||
|
||||
queue.Packets = append(l, PacketWithData{
|
||||
MessageType: messageType,
|
||||
MessageType: packet.MessageType,
|
||||
Added: ts,
|
||||
Data: data,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user