aboutsummaryrefslogtreecommitdiff
path: root/hotline/client.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2024-06-17 20:30:49 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2024-06-17 20:30:49 -0700
commit153e2eac3b51a6a426556752fa2c532cfe53f026 (patch)
treedf83911537b02f61396ecbca5c4796fd0c3db958 /hotline/client.go
parentf8e4cd540b87de3e308ec18a2b040b284a741522 (diff)
Use fixed size array types in Transaction fields
Diffstat (limited to 'hotline/client.go')
-rw-r--r--hotline/client.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/hotline/client.go b/hotline/client.go
index 33dbd0d..cd6fa12 100644
--- a/hotline/client.go
+++ b/hotline/client.go
@@ -142,11 +142,11 @@ func (c *Client) Handshake() error {
}
func (c *Client) Send(t Transaction) error {
- requestNum := binary.BigEndian.Uint16(t.Type)
+ requestNum := binary.BigEndian.Uint16(t.Type[:])
// if transaction is NOT reply, add it to the list to transactions we're expecting a response for
if t.IsReply == 0 {
- c.activeTasks[binary.BigEndian.Uint32(t.ID)] = &t
+ c.activeTasks[binary.BigEndian.Uint32(t.ID[:])] = &t
}
n, err := io.Copy(c.Connection, &t)
@@ -165,16 +165,16 @@ func (c *Client) Send(t Transaction) error {
func (c *Client) HandleTransaction(ctx context.Context, t *Transaction) error {
var origT Transaction
if t.IsReply == 1 {
- requestID := binary.BigEndian.Uint32(t.ID)
+ requestID := binary.BigEndian.Uint32(t.ID[:])
origT = *c.activeTasks[requestID]
t.Type = origT.Type
}
- if handler, ok := c.Handlers[binary.BigEndian.Uint16(t.Type)]; ok {
+ if handler, ok := c.Handlers[binary.BigEndian.Uint16(t.Type[:])]; ok {
c.Logger.Debug(
"Received transaction",
"IsReply", t.IsReply,
- "type", binary.BigEndian.Uint16(t.Type),
+ "type", binary.BigEndian.Uint16(t.Type[:]),
)
outT, err := handler(ctx, c, t)
if err != nil {
@@ -189,7 +189,7 @@ func (c *Client) HandleTransaction(ctx context.Context, t *Transaction) error {
c.Logger.Debug(
"Unimplemented transaction type",
"IsReply", t.IsReply,
- "type", binary.BigEndian.Uint16(t.Type),
+ "type", binary.BigEndian.Uint16(t.Type[:]),
)
}