Skip to content

Commit

Permalink
Merge pull request #6726 from TheThingsNetwork/feature/disconnect-on-…
Browse files Browse the repository at this point in the history
…gateway-server-change

Disconnect gateway on Gateway Server address change
  • Loading branch information
adriansmares authored Nov 30, 2023
2 parents eef2d78 + 9f338bc commit c24ca19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ For details about compatibility between different releases, see the **Commitment
### Changed

- Server side events replaced with single socket connection using the native WebSocket API.
- Gateways now disconnect if the Gateway Server address has changed.
- This enables CUPS-enabled gateways to change their LNS before the periodic CUPS lookup occurs.

### Deprecated

Expand Down
5 changes: 4 additions & 1 deletion pkg/gatewayserver/gatewayserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ func (gs *GatewayServer) Connect(
"enforce_duty_cycle",
"frequency_plan_id",
"frequency_plan_ids",
"gateway_server_address",
"location_public",
"require_authenticated_connection",
"schedule_anytime_delay",
Expand Down Expand Up @@ -611,7 +612,8 @@ func requireDisconnect(connected, current *ttnpb.Gateway) bool {
connected.StatusPublic != current.StatusPublic ||
connected.UpdateLocationFromStatus != current.UpdateLocationFromStatus ||
connected.FrequencyPlanId != current.FrequencyPlanId ||
len(connected.FrequencyPlanIds) != len(current.FrequencyPlanIds) {
len(connected.FrequencyPlanIds) != len(current.FrequencyPlanIds) ||
connected.GatewayServerAddress != current.GatewayServerAddress {
return true
}
for i := range connected.FrequencyPlanIds {
Expand Down Expand Up @@ -646,6 +648,7 @@ func (gs *GatewayServer) startDisconnectOnChangeTask(conn connectionEntry) {
"enforce_duty_cycle",
"frequency_plan_id",
"frequency_plan_ids",
"gateway_server_address",
"location_public",
"require_authenticated_connection",
"schedule_anytime_delay",
Expand Down

0 comments on commit c24ca19

Please sign in to comment.