kill bridge only when connected
This commit is contained in:
parent
aac90dd113
commit
e85f521cb3
5
main.go
5
main.go
@ -192,13 +192,12 @@ func main() {
|
|||||||
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
|
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
|
||||||
<-sc
|
<-sc
|
||||||
|
|
||||||
// Signal the bridge to exit cleanly
|
|
||||||
close(Bridge.BridgeDie)
|
|
||||||
|
|
||||||
log.Println("OS Signal. Bot shutting down")
|
log.Println("OS Signal. Bot shutting down")
|
||||||
|
|
||||||
// Wait or the bridge to exit cleanly
|
// Wait or the bridge to exit cleanly
|
||||||
if Bridge.Connected {
|
if Bridge.Connected {
|
||||||
|
//TODO BridgeDie occasionally panics on send to closed channel
|
||||||
|
Bridge.BridgeDie <- true
|
||||||
Bridge.WaitExit.Wait()
|
Bridge.WaitExit.Wait()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user