Skip to content

Commit a20e0ac

Browse files
committed
Fix decoding gateway id from string. Do not encode empty fields (JSON).
1 parent 2242e06 commit a20e0ac

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

internal/backend/semtechudp/backend.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,9 @@ func (b *Backend) handleStats(gatewayID lorawan.EUI64, stats *gw.GatewayStats) {
496496
func (b *Backend) handleUplinkFrames(uplinkFrames []*gw.UplinkFrame) error {
497497
for i := range uplinkFrames {
498498
var gatewayID lorawan.EUI64
499-
copy(gatewayID[:], uplinkFrames[i].GetRxInfo().GatewayId)
499+
if err := gatewayID.UnmarshalText([]byte(uplinkFrames[i].GetRxInfo().GetGatewayId())); err != nil {
500+
return errors.Wrap(err, "decode gateway id error")
501+
}
500502

501503
if conn, err := b.gateways.get(gatewayID); err == nil {
502504
conn.stats.CountUplink(uplinkFrames[i])

internal/integration/mqtt/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func NewBackend(conf config.Config) (*Backend, error) {
9797
case "json":
9898
b.marshal = func(msg proto.Message) ([]byte, error) {
9999
return protojson.MarshalOptions{
100-
EmitUnpopulated: true,
100+
EmitUnpopulated: false,
101101
}.Marshal(msg)
102102
}
103103

0 commit comments

Comments
 (0)