mirror of
https://github.com/stryan/mumble-discord-bridge.git
synced 2024-11-14 19:45:41 -05:00
remove default case from mumble onAudioStream
This commit is contained in:
parent
b1132114c9
commit
cb5ca33b0c
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
.env
|
.env
|
||||||
main
|
main
|
||||||
mumble-discord-bridge
|
mumble-discord-bridge
|
||||||
|
bridge
|
||||||
|
.prof
|
15
main.go
15
main.go
@ -5,6 +5,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"runtime/pprof"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
@ -17,6 +18,8 @@ import (
|
|||||||
_ "layeh.com/gumble/opus"
|
_ "layeh.com/gumble/opus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
godotenv.Load()
|
godotenv.Load()
|
||||||
|
|
||||||
@ -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
|
//Connect to discord
|
||||||
discord, err := discordgo.New("Bot " + *discordToken)
|
discord, err := discordgo.New("Bot " + *discordToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -33,7 +33,6 @@ func (m MumbleDuplex) OnAudioStream(e *gumble.AudioStreamEvent) {
|
|||||||
log.Println("new mumble audio stream", e.User.Name)
|
log.Println("new mumble audio stream", e.User.Name)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
default:
|
|
||||||
case <-die:
|
case <-die:
|
||||||
log.Println("Removing mumble audio stream")
|
log.Println("Removing mumble audio stream")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user