Do spam unready session error on voice reconnec

This commit is contained in:
Bruce Marriner 2016-06-16 14:53:05 -05:00
parent 79d49f86fb
commit e76dafab78

View file

@ -812,10 +812,6 @@ func (v *VoiceConnection) reconnect() {
// Close websocket and udp connections // Close websocket and udp connections
v.Close() v.Close()
// Take a short nap to allow everything to close.
// may not be needed but just extra protection for now.
time.Sleep(1 * time.Second)
wait := time.Duration(1) wait := time.Duration(1)
i := 0 i := 0
@ -828,6 +824,14 @@ func (v *VoiceConnection) reconnect() {
return return
} }
<-time.After(wait * time.Second)
wait *= 2
if wait > 600 {
wait = 600
}
i++
if v.session.DataReady == false { if v.session.DataReady == false {
v.log(LogInformational, "cannot reconenct with unready session") v.log(LogInformational, "cannot reconenct with unready session")
continue continue
@ -858,11 +862,5 @@ func (v *VoiceConnection) reconnect() {
return return
} }
<-time.After(wait * time.Second)
wait *= 2
if wait > 600 {
wait = 600
}
i++
} }
} }