func (s *session) Close() error {
	s.closeOnce.Do(func() {
		// closing needs to happen asynchronously because the last client
		// (session writer) will try to close this session, causing a deadlock
		// because of closeOnce
		go func() {
			log.Infof("session.Close(%v)", s.id)
			if s.term != nil {
				s.term.Close()
			}
			close(s.closeC)

			// close all writers in our multi-writer
			s.writer.Lock()
			defer s.writer.Unlock()
			for writerName, writer := range s.writer.writers {
				log.Infof("session.close(writer=%v)", writerName)
				closer, ok := io.Writer(writer).(io.WriteCloser)
				if ok {
					closer.Close()
				}
			}
		}()
	})
	return nil
}
// Close ends the active session forcing all clients to disconnect and freeing all resources
Close ends the active session forcing all clients to disconnect and freeing all resources
// Close ends the active session forcing all clients to disconnect and freeing all resources
func (s *session) Close() error {
	s.closeOnce.Do(func() {
		go func() {
			log.Infof("session.Close(%v)", s.id)
			if s.term != nil {
				s.term.Close()
			}
			close(s.closeC)
			s.writer.Lock()
			defer s.writer.Unlock()
			for writerName, writer := range s.writer.writers {
				log.Infof("session.close(writer=%v)", writerName)
				closer, ok := io.Writer(writer).(io.WriteCloser)
				if ok {
					closer.Close()
				}
			}
		}()
	})
	return nil
}
func ( s * session ) Close ( ) error { s . closeOnce . Do ( func ( ) { go func ( ) { log . Infof ( " " , s . id ) if s . term != nil { s . term . Close ( ) } close ( s . closeC ) s . writer . Lock ( ) defer s . writer . Unlock ( ) for writerName , writer := range s . writer . writers { log . Infof ( " " , writerName ) closer , ok := io . Writer ( writer ) . ( io . WriteCloser ) if ok { closer . Close ( ) } } } ( ) } ) return nil }
Close ends the active session forcing all clients to disconnect and freeing all resources
Close ends the active session forcing all clients to disconnect and freeing all resources
// closing needs to happen asynchronously because the last client // (session writer) will try to close this session, causing a deadlock // because of closeOnce // close all writers in our multi-writer