Skip to content

Commit

Permalink
fix wrong implementaion of parsing values
Browse files Browse the repository at this point in the history
The old implementaion was not followed by
https://collectd.org/wiki/index.php/Binary_protocol

This patch fixes it.

Signed-off-by: Kai Zhang <[email protected]>
  • Loading branch information
kylezh committed Mar 2, 2015
1 parent 1d0fc88 commit 2c1e03b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gollectd.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ func Packets(b []byte, types Types) (*[]Packet, error) {
packet.Values = make([]Value, valueCount, valueCount)
var packetValue Value

err = binary.Read(partBuffer, binary.BigEndian, &valueTypes)
if err != nil {
return nil, err
}

for i, t := range valueTypes {
err = binary.Read(partBuffer, binary.BigEndian, &t)
if err != nil {
return nil, err
}

packetValue.Type = t

if typeName, ok := ValueTypeValues[t]; ok {
Expand Down

0 comments on commit 2c1e03b

Please sign in to comment.