deleted some dead code

This commit is contained in:
2026-07-01 14:49:30 +01:00
parent c3ee9c0f44
commit 245d6ac0e1
2 changed files with 1 additions and 6 deletions
-4
View File
@@ -3,7 +3,6 @@
package bngsdk package bngsdk
import ( import (
"bytes"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"math" "math"
@@ -22,8 +21,6 @@ type BeamNGSDK struct {
Conn *net.UDPConn Conn *net.UDPConn
Buffer []byte Buffer []byte
Data Outgauge Data Outgauge
// Internal data
reader bytes.Reader
} }
func createUDPConnection(ip string, port int) (*net.UDPConn, *net.UDPAddr, error) { func createUDPConnection(ip string, port int) (*net.UDPConn, *net.UDPAddr, error) {
@@ -84,7 +81,6 @@ func (sdk *BeamNGSDK) ReadData() error {
} }
// Read the binary data into the struct // Read the binary data into the struct
sdk.reader.Reset(sdk.Buffer[:n])
err = sdk.parseData() err = sdk.parseData()
if err != nil { if err != nil {
fmt.Println("Error decoding UDP packet:", err) fmt.Println("Error decoding UDP packet:", err)
+1 -2
View File
@@ -38,9 +38,8 @@ func BenchmarkReadData(b *testing.B) {
} }
packetBytes := buf.Bytes() packetBytes := buf.Bytes()
// 4. Reset the timer to isolate the setup allocations from the loop metrics
b.ResetTimer() b.ResetTimer()
b.ReportAllocs() // Tracks memory allocations per operation (B/op and allocs/op) b.ReportAllocs()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
// Feed a packet into the network buffer right before reading it // Feed a packet into the network buffer right before reading it