Skip to content

Commit

Permalink
fix: avoid re-activations of an inactive bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
0x416e746f6e committed Sep 8, 2024
1 parent 07cb0db commit c339cc7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

/bin/*
!/bin/.gitkeep
/cmd/__debug*
dist

# ide
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ serve:

.PHONY: docker-compose
docker-compose:
@VPNHAM_LOG_LEVEL=debug docker compose down --remove-orphans
@VPNHAM_LOG_LEVEL=debug docker compose up --build || docker compose down --remove-orphans
docker compose down --remove-orphans
@VPNHAM_LOG_LEVEL=info docker compose up --build || docker compose down --remove-orphans
7 changes: 7 additions & 0 deletions bridge/events_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bridge

import (
"context"
"time"

"github.com/flashbots/vpnham/event"
"github.com/flashbots/vpnham/logutils"
Expand Down Expand Up @@ -81,6 +82,12 @@ func (s *Server) eventBridgeDeactivated(ctx context.Context, _ *event.BridgeDeac
l := logutils.LoggerFromContext(ctx)

l.Info("Bridge deactivated")

if r := s.cfg.Reconcile.BridgeActivate.Reapply; r.Enabled() {
ba := s.reapply.bridgeActivate
ba.Count = 0
ba.Next = time.Time{} // disable re-activations of an inactive bridge
}
}

func (s *Server) eventBridgeActivated(ctx context.Context, e *event.BridgeActivated, failureSink chan<- error) {
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ services:
VPNHAM_LOG_MODE: dev
ports:
- 8000:8000
- 8100:8080
volumes:
- type: bind
source: ./.dev/br-lft-act.yaml
Expand All @@ -66,6 +67,7 @@ services:
target: /app/.vpnham.yaml
ports:
- 8001:8001
- 8101:8080
cap_add:
- NET_ADMIN
networks:
Expand All @@ -84,6 +86,7 @@ services:
VPNHAM_LOG_MODE: dev
ports:
- 8010:8010
- 8110:8080
volumes:
- type: bind
source: ./.dev/br-rgt-act.yaml
Expand All @@ -106,6 +109,7 @@ services:
VPNHAM_LOG_MODE: dev
ports:
- 8011:8011
- 8111:8080
volumes:
- type: bind
source: ./.dev/br-rgt-sby.yaml
Expand Down

0 comments on commit c339cc7

Please sign in to comment.