refactor everything again
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m51s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m51s
This commit is contained in:
@@ -89,11 +89,11 @@ func (m *TCPCartServerMux) handleFunction(connection net.Conn, messageType uint1
|
||||
}
|
||||
|
||||
func (m *TCPCartServerMux) HandleConnection(connection net.Conn) error {
|
||||
var packet *CartPacket
|
||||
var packet CartPacket
|
||||
var err error
|
||||
defer connection.Close()
|
||||
for {
|
||||
err = ReadPacket(connection, packet)
|
||||
err = ReadPacket(connection, &packet)
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
@@ -101,10 +101,7 @@ func (m *TCPCartServerMux) HandleConnection(connection net.Conn) error {
|
||||
log.Printf("Error receiving packet: %v\n", err)
|
||||
return err
|
||||
}
|
||||
if packet == nil {
|
||||
log.Println("Packet is nil")
|
||||
continue
|
||||
}
|
||||
|
||||
data, err := GetPacketData(connection, int(packet.DataLength))
|
||||
if err != nil {
|
||||
log.Printf("Error getting packet data: %v\n", err)
|
||||
|
||||
Reference in New Issue
Block a user