File tree Expand file tree Collapse file tree 5 files changed +13
-13
lines changed
cmd/chirpstack-gateway-bridge/cmd Expand file tree Collapse file tree 5 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ type="{{ .Backend.Type }}"
9292 # ChirpStack Gateway Bridge keeps a list of connected gateways. If a gateway does not send any
9393 # UDP data within the configured timeout, then ChirpStack Gateway Bridge will consider the gateway
9494 # disconnected and it will unsubscribe from the gateway MQTT topic and cleanup the UDP docket.
95- connection_timeout_duration={{ .Backend.SemtechUDP.CleanupDuration }}
95+ connection_timeout_duration=" {{ .Backend.SemtechUDP.ConnectionTimeoutDuration }}"
9696
9797 # Cache expiration
9898 #
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ func init() {
3939 viper .SetDefault ("general.log_level" , 4 )
4040 viper .SetDefault ("backend.type" , "semtech_udp" )
4141 viper .SetDefault ("backend.semtech_udp.udp_bind" , "0.0.0.0:1700" )
42- viper .SetDefault ("backend.semtech_udp.cleanup_duration " , time .Minute )
42+ viper .SetDefault ("backend.semtech_udp.connection_timeout_duration " , time .Minute )
4343
4444 viper .SetDefault ("backend.semtech_udp.cache_default_expiration" , 15 * time .Second )
4545 viper .SetDefault ("backend.semtech_udp.cache_cleanup_interval" , 15 * time .Second )
Original file line number Diff line number Diff line change @@ -67,8 +67,8 @@ func NewBackend(conf config.Config) (*Backend, error) {
6767 conn : conn ,
6868 udpSendChan : make (chan udpPacket ),
6969 gateways : gateways {
70- gateways : make (map [lorawan.EUI64 ]gateway ),
71- cleanupDuration : time . Duration ( conf .Backend .SemtechUDP .CleanupDuration ) ,
70+ gateways : make (map [lorawan.EUI64 ]gateway ),
71+ connectionTimeoutDuration : conf .Backend .SemtechUDP .ConnectionTimeoutDuration ,
7272 },
7373 fakeRxTime : conf .Backend .SemtechUDP .FakeRxTime ,
7474 skipCRCCheck : conf .Backend .SemtechUDP .SkipCRCCheck ,
Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ type gateway struct {
2727// gateways contains the gateways registry.
2828type gateways struct {
2929 sync.RWMutex
30- gateways map [lorawan.EUI64 ]gateway
31- cleanupDuration time.Duration
30+ gateways map [lorawan.EUI64 ]gateway
31+ connectionTimeoutDuration time.Duration
3232
3333 subscribeEventFunc func (events.Subscribe )
3434}
@@ -79,7 +79,7 @@ func (c *gateways) cleanup() error {
7979 defer c .Unlock ()
8080
8181 for gatewayID := range c .gateways {
82- if c .gateways [gatewayID ].lastSeen .Before (time .Now ().Add (c . cleanupDuration )) {
82+ if c .gateways [gatewayID ].lastSeen .Before (time .Now ().Add (- 1 * c . connectionTimeoutDuration )) {
8383 disconnectCounter ().Inc ()
8484
8585 if c .subscribeEventFunc != nil {
Original file line number Diff line number Diff line change @@ -21,12 +21,12 @@ type Config struct {
2121 Type string `mapstructure:"type"`
2222
2323 SemtechUDP struct {
24- UDPBind string `mapstructure:"udp_bind"`
25- SkipCRCCheck bool `mapstructure:"skip_crc_check"`
26- FakeRxTime bool `mapstructure:"fake_rx_time"`
27- CleanupDuration int `mapstructure:"connection_timeout_duration"`
28- CacheDefaultExpiration time.Duration `mapstructure:"cache_default_expiration"`
29- CacheCleanupInterval time.Duration `mapstructure:"cache_cleanup_interval"`
24+ UDPBind string `mapstructure:"udp_bind"`
25+ SkipCRCCheck bool `mapstructure:"skip_crc_check"`
26+ FakeRxTime bool `mapstructure:"fake_rx_time"`
27+ ConnectionTimeoutDuration time. Duration `mapstructure:"connection_timeout_duration"`
28+ CacheDefaultExpiration time.Duration `mapstructure:"cache_default_expiration"`
29+ CacheCleanupInterval time.Duration `mapstructure:"cache_cleanup_interval"`
3030 } `mapstructure:"semtech_udp"`
3131
3232 BasicStation struct {
You can’t perform that action at this time.
0 commit comments