Created
January 9, 2023 13:09
-
-
Save glober-vaibhav/ff0b9737c32baddca11cd44a82b46ede to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Close closes the agent | |
func (b *Agent) Close() { | |
b.mu.Lock() | |
defer b.mu.Unlock() | |
if b.closed { | |
return | |
} | |
b.closed = true | |
close(b.quit) | |
for _, ch := range b.subs { | |
for _, sub := range ch { | |
close(sub) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment