Skip to content

Commit

Permalink
remove default case from mumble onAudioStream
Browse files Browse the repository at this point in the history
  • Loading branch information
Stieneee committed Jan 16, 2021
1 parent b113211 commit cb5ca33
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
@@ -1,3 +1,5 @@
.env
main
mumble-discord-bridge
mumble-discord-bridge
bridge
.prof
15 changes: 15 additions & 0 deletions main.go
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"os"
"os/signal"
"runtime/pprof"
"strconv"
"sync"
"syscall"
Expand All @@ -17,6 +18,8 @@ import (
_ "layeh.com/gumble/opus"
)

var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`")

func main() {
godotenv.Load()

Expand Down Expand Up @@ -61,6 +64,18 @@ func main() {
}
}

if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
log.Fatal("could not create CPU profile: ", err)
}
defer f.Close() // error handling omitted for example
if err := pprof.StartCPUProfile(f); err != nil {
log.Fatal("could not start CPU profile: ", err)
}
defer pprof.StopCPUProfile()
}

//Connect to discord
discord, err := discordgo.New("Bot " + *discordToken)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion mumble.go
Expand Up @@ -33,7 +33,6 @@ func (m MumbleDuplex) OnAudioStream(e *gumble.AudioStreamEvent) {
log.Println("new mumble audio stream", e.User.Name)
for {
select {
default:
case <-die:
log.Println("Removing mumble audio stream")
return
Expand Down

0 comments on commit cb5ca33

Please sign in to comment.