File tree Expand file tree Collapse file tree 5 files changed +15
-7
lines changed
cmd/chirpstack-gateway-bridge/cmd Expand file tree Collapse file tree 5 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,9 @@ type="{{ .Backend.Type }}"
88
88
# the time would otherwise be unset.
89
89
fake_rx_time={{ .Backend.SemtechUDP.FakeRxTime }}
90
90
91
+ # Cleanup duration
92
+ # Cleaup duration for class C devices
93
+ cleanup_duration={{ .Backend.SemtechUDP.CleanupDuration }}
91
94
92
95
# ChirpStack Concentratord backend.
93
96
[backend.concentratord]
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ func init() {
39
39
viper .SetDefault ("general.log_level" , 4 )
40
40
viper .SetDefault ("backend.type" , "semtech_udp" )
41
41
viper .SetDefault ("backend.semtech_udp.udp_bind" , "0.0.0.0:1700" )
42
+ viper .SetDefault ("backend.semtech_udp.cleanup_duration" , - 1 )
42
43
43
44
viper .SetDefault ("backend.concentratord.crc_check" , true )
44
45
viper .SetDefault ("backend.concentratord.event_url" , "ipc:///tmp/concentratord_event" )
Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ func NewBackend(conf config.Config) (*Backend, error) {
67
67
conn : conn ,
68
68
udpSendChan : make (chan udpPacket ),
69
69
gateways : gateways {
70
- gateways : make (map [lorawan.EUI64 ]gateway ),
70
+ gateways : make (map [lorawan.EUI64 ]gateway ),
71
+ cleanupDuration : time .Duration (conf .Backend .SemtechUDP .CleanupDuration ),
71
72
},
72
73
fakeRxTime : conf .Backend .SemtechUDP .FakeRxTime ,
73
74
skipCRCCheck : conf .Backend .SemtechUDP .SkipCRCCheck ,
Original file line number Diff line number Diff line change 18
18
19
19
// gatewayCleanupDuration contains the duration after which the gateway is
20
20
// cleaned up from the registry after no activity
21
- var gatewayCleanupDuration = - 1 * time .Minute
21
+ // This value can be set in config [backend.SemtechUDP.cleanup_duration]
22
+ // var gatewayCleanupDuration = time.Duration(config.C.Backend.SemtechUDP.CleanupDuration) + (-1 * time.Minute)
22
23
23
24
// gateway contains a connection and meta-data for a gateway connection.
24
25
type gateway struct {
@@ -31,7 +32,8 @@ type gateway struct {
31
32
// gateways contains the gateways registry.
32
33
type gateways struct {
33
34
sync.RWMutex
34
- gateways map [lorawan.EUI64 ]gateway
35
+ gateways map [lorawan.EUI64 ]gateway
36
+ cleanupDuration time.Duration
35
37
36
38
subscribeEventFunc func (events.Subscribe )
37
39
}
@@ -82,7 +84,7 @@ func (c *gateways) cleanup() error {
82
84
defer c .Unlock ()
83
85
84
86
for gatewayID := range c .gateways {
85
- if c .gateways [gatewayID ].lastSeen .Before (time .Now ().Add (gatewayCleanupDuration )) {
87
+ if c .gateways [gatewayID ].lastSeen .Before (time .Now ().Add (c . cleanupDuration )) {
86
88
disconnectCounter ().Inc ()
87
89
88
90
if c .subscribeEventFunc != nil {
Original file line number Diff line number Diff line change @@ -21,9 +21,10 @@ type Config struct {
21
21
Type string `mapstructure:"type"`
22
22
23
23
SemtechUDP struct {
24
- UDPBind string `mapstructure:"udp_bind"`
25
- SkipCRCCheck bool `mapstructure:"skip_crc_check"`
26
- FakeRxTime bool `mapstructure:"fake_rx_time"`
24
+ UDPBind string `mapstructure:"udp_bind"`
25
+ SkipCRCCheck bool `mapstructure:"skip_crc_check"`
26
+ FakeRxTime bool `mapstructure:"fake_rx_time"`
27
+ CleanupDuration int `mapstructure:"cleanup_duration"`
27
28
} `mapstructure:"semtech_udp"`
28
29
29
30
BasicStation struct {
You can’t perform that action at this time.
0 commit comments