Skip to content

Commit

Permalink
disconnect a pds when we block it
Browse files Browse the repository at this point in the history
  • Loading branch information
brianolson committed Jan 9, 2025
1 parent ad3c38b commit 3232473
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bgs/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ func (bgs *BGS) handleBlockPDS(e echo.Context) error {
return err
}

// don't care if this errors, but we should try to disconnect something we just blocked
_ = bgs.slurper.KillUpstreamConnection(host, false)

return e.JSON(200, map[string]any{
"success": "true",
})
Expand Down
1 change: 1 addition & 0 deletions bgs/fedmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ func (s *Slurper) KillUpstreamConnection(host string, block bool) error {
return fmt.Errorf("killing connection %q: %w", host, ErrNoActiveConnection)
}
ac.cancel()
// cleanup in the run thread subscribeWithRedialer() will delete(s.active, host)

if block {
if err := s.db.Model(models.PDS{}).Where("id = ?", ac.pds.ID).UpdateColumn("blocked", true).Error; err != nil {
Expand Down

0 comments on commit 3232473

Please sign in to comment.