Added logging statements

This commit is contained in:
Bruce Marriner 2016-04-28 09:27:57 -05:00
parent 2b85edc4a1
commit dd69a7e27f
2 changed files with 4 additions and 0 deletions

View file

@ -126,6 +126,7 @@ func (v *VoiceConnection) Disconnect() (err error) {
// Close websocket and udp connections
v.Close()
v.log(LogInformational, "Deleting VoiceConnection %s", v.GuildID)
delete(v.session.VoiceConnections, v.GuildID)
return
@ -428,6 +429,7 @@ func (v *VoiceConnection) wsHeartbeat(wsConn *websocket.Conn, close <-chan struc
var err error
ticker := time.NewTicker(i * time.Millisecond)
for {
v.log(LogDebug, "Sending heartbeat packet")
err = wsConn.WriteJSON(voiceHeartbeatOp{3, int(time.Now().Unix())})
if err != nil {
log.Println("wsHeartbeat send error: ", err)

View file

@ -377,6 +377,7 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *Voi
data := voiceChannelJoinOp{4, voiceChannelJoinData{&gID, &cID, mute, deaf}}
err = s.wsConn.WriteJSON(data)
if err != nil {
s.log(LogInformational, "Deleting VoiceConnection %s", gID)
delete(s.VoiceConnections, gID)
return
}
@ -385,6 +386,7 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *Voi
err = voice.waitUntilConnected()
if err != nil {
voice.Close()
s.log(LogInformational, "Deleting VoiceConnection %s", gID)
delete(s.VoiceConnections, gID)
return
}