mirror of
https://github.com/nonoo/kappanhang.git
synced 2026-02-05 07:14:53 +01:00
Modify exit logging
This commit is contained in:
parent
322284e13f
commit
77d3f7bb40
10
main.go
10
main.go
|
|
@ -17,15 +17,11 @@ func exit(err error) {
|
|||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
}
|
||||
log.Print("disconnecting")
|
||||
|
||||
if streams.audio.common.conn != nil {
|
||||
streams.audio.sendDisconnect()
|
||||
}
|
||||
if streams.control.common.conn != nil {
|
||||
streams.control.sendDisconnect()
|
||||
}
|
||||
streams.audio.sendDisconnect()
|
||||
streams.control.sendDisconnect()
|
||||
|
||||
log.Print("exiting")
|
||||
if err == nil {
|
||||
os.Exit(0)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -170,10 +170,11 @@ func (s *streamCommon) waitForPkt6Answer() {
|
|||
}
|
||||
|
||||
func (s *streamCommon) sendDisconnect() {
|
||||
if !s.gotRemoteSID {
|
||||
if !s.gotRemoteSID || s.conn == nil {
|
||||
return
|
||||
}
|
||||
|
||||
log.Print(s.name + "/disconnecting")
|
||||
s.send([]byte{0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
|
||||
byte(s.localSID >> 24), byte(s.localSID >> 16), byte(s.localSID >> 8), byte(s.localSID),
|
||||
byte(s.remoteSID >> 24), byte(s.remoteSID >> 16), byte(s.remoteSID >> 8), byte(s.remoteSID)})
|
||||
|
|
|
|||
Loading…
Reference in a new issue