@@ -192,25 +192,25 @@ func (b *Backend) SendDownlinkFrame(frame gw.DownlinkFrame) error {
192192// ApplyConfiguration applies the given configuration to the gateway
193193// (packet-forwarder).
194194func (b * Backend ) ApplyConfiguration (config gw.GatewayConfiguration ) error {
195- return gatewayConfigHandleTimer (func () error {
196- var gatewayID lorawan.EUI64
197- copy (gatewayID [:], config .GatewayId )
198-
199- b .Lock ()
200- var pfConfig * pfConfiguration
201- for i := range b .configurations {
202- if b .configurations [i ].gatewayID == gatewayID {
203- pfConfig = & b .configurations [i ]
204- }
205- }
206- b .Unlock ()
195+ eventCounter ("configuration" )
196+
197+ var gatewayID lorawan.EUI64
198+ copy (gatewayID [:], config .GatewayId )
207199
208- if pfConfig == nil {
209- return errGatewayDoesNotExist
200+ b .Lock ()
201+ var pfConfig * pfConfiguration
202+ for i := range b .configurations {
203+ if b .configurations [i ].gatewayID == gatewayID {
204+ pfConfig = & b .configurations [i ]
210205 }
206+ }
207+ b .Unlock ()
211208
212- return b .applyConfiguration (* pfConfig , config )
213- })
209+ if pfConfig == nil {
210+ return errGatewayDoesNotExist
211+ }
212+
213+ return b .applyConfiguration (* pfConfig , config )
214214}
215215
216216func (b * Backend ) applyConfiguration (pfConfig pfConfiguration , config gw.GatewayConfiguration ) error {
@@ -315,11 +315,8 @@ func (b *Backend) sendPackets() error {
315315 "protocol_version" : p .data [0 ],
316316 }).Debug ("backend/semtechudp: sending udp packet to gateway" )
317317
318- err = gatewayWriteUDPTimer (pt .String (), func () error {
319- _ , err := b .conn .WriteToUDP (p .data , p .addr )
320- return err
321- })
322-
318+ udpWriteCounter (pt .String ())
319+ _ , err = b .conn .WriteToUDP (p .data , p .addr )
323320 if err != nil {
324321 log .WithFields (log.Fields {
325322 "addr" : p .addr ,
@@ -349,18 +346,18 @@ func (b *Backend) handlePacket(up udpPacket) error {
349346 "protocol_version" : up .data [0 ],
350347 }).Debug ("backend/semtechudp: received udp packet from gateway" )
351348
352- return gatewayHandleTimer (pt .String (), func () error {
353- switch pt {
354- case packets . PushData :
355- return b . handlePushData ( up )
356- case packets . PullData :
357- return b . handlePullData ( up )
358- case packets . TXACK :
359- return b . handleTXACK ( up )
360- default :
361- return fmt . Errorf ( "backend/semtechudp: unknown packet type: %s" , pt )
362- }
363- })
349+ udpReadCounter (pt .String ())
350+
351+ switch pt {
352+ case packets . PushData :
353+ return b . handlePushData ( up )
354+ case packets . PullData :
355+ return b . handlePullData ( up )
356+ case packets . TXACK :
357+ return b . handleTXACK ( up )
358+ default :
359+ return fmt . Errorf ( "backend/semtechudp: unknown packet type: %s" , pt )
360+ }
364361}
365362
366363func (b * Backend ) handlePullData (up udpPacket ) error {
0 commit comments