Skip to content

Commit a5c1dd7

Browse files
AOrobatorclaude
andcommitted
fix: delete orphaned onion service on concurrent start race
If two goroutines raced through Start(), the losing goroutine would close the control connection but leave an orphaned hidden service on the Tor daemon. Now we call DelOnion before closing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fb3245f commit a5c1dd7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tor/tor.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ func (s *Service) Start(cfg *Config) error {
155155
s.mu.Lock()
156156
defer s.mu.Unlock()
157157
if s.running {
158-
// Another goroutine started concurrently — clean up
158+
// Another goroutine started concurrently — clean up orphaned onion service
159+
_ = ctrl.DelOnion(resp.ServiceID)
159160
ctrl.Close()
160161
return errors.New("tor service was started concurrently")
161162
}

0 commit comments

Comments
 (0)