Modify session close function to do a better job

This commit is contained in:
Bruce Marriner 2016-01-04 13:13:10 -06:00
parent b329c935ac
commit 1ae278b8c0

View file

@ -151,3 +151,17 @@ func New(args ...interface{}) (s *Session, err error) {
return
}
// Close closes a Discord session
// TODO: Add support for Voice WS/UDP connections
func (s *Session) Close() {
s.DataReady = false
close(s.listenChan)
close(s.heartbeatChan)
if s.wsConn != nil {
s.wsConn.Close()
}
}