Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sqp): Request metrics chunk in the default queryer #31

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func server(l *log.Logger, proto, address string) error {
GameType: "Game Type",
Map: "Map",
Port: 1000,
Metrics: []float32{-1, 0, 1, 3.14159, 1253.232, -933.32},
})
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion lib/svrquery/protocol/sqp/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const (
DefaultMaxPacketSize = 1472

// Version is the query protocol version this client uses.
Version = uint16(1)
Version = uint16(2)

// MaxMetrics is the maximum number of metrics supported in a request.
MaxMetrics = byte(25)
Expand Down
6 changes: 4 additions & 2 deletions lib/svrquery/protocol/sqp/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ type queryer struct {
requestedChunks byte
}

func newCreator(c protocol.Client) protocol.Queryer {
return newQueryer(ServerInfo, DefaultMaxPacketSize, c)
func newCreator(requestedChunks byte) func(c protocol.Client) protocol.Queryer {
return func(c protocol.Client) protocol.Queryer {
return newQueryer(requestedChunks, DefaultMaxPacketSize, c)
}
}

func newQueryer(requestedChunks byte, maxPktSize int, c protocol.Client) *queryer {
Expand Down
3 changes: 2 additions & 1 deletion lib/svrquery/protocol/sqp/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ import (
)

func init() {
protocol.MustRegister("sqp", newCreator)
protocol.MustRegister("sqp", newCreator(ServerInfo))
protocol.MustRegister("sqp2", newCreator(ServerInfo|Metrics))
milonoir marked this conversation as resolved.
Show resolved Hide resolved
}
Binary file not shown.
Binary file modified lib/svrquery/protocol/sqp/testdata/info_single_request
Binary file not shown.
Binary file modified lib/svrquery/protocol/sqp/testdata/metrics_request
Binary file not shown.
Binary file modified lib/svrquery/protocol/sqp/testdata/player_request
Binary file not shown.
Binary file modified lib/svrquery/protocol/sqp/testdata/rules_request
Binary file not shown.
Binary file modified lib/svrquery/protocol/sqp/testdata/team_request
Binary file not shown.