func (s *Session) CloseChan() <-chan struct{} {
	return s.shutdownCh
}
CloseChan returns a read-only channel which is closed as
soon as the session is closed.
package yamux
import (
	"bufio"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"math"
	"net"
	"strings"
	"sync"
	"sync/atomic"
	"time"
)
type Session struct {
	remoteGoAway int32
	localGoAway int32
	nextStreamID uint32
	config *Config
	logger *log.Logger
	conn io.ReadWriteCloser
	bufRead *bufio.Reader
	pings    map[uint32]chan struct{}
	pingID   uint32
	pingLock sync.Mutex
	streams    map[uint32]*Stream
	inflight   map[uint32]struct{}
	streamLock sync.Mutex
	synCh chan struct{}
	acceptCh chan *Stream
	sendCh chan sendReady
	recvDoneCh chan struct{}
	shutdown     bool
	shutdownErr  error
	shutdownCh   chan struct{}
	shutdownLock sync.Mutex
}
type sendReady struct {
	Hdr  []byte
	Body io.Reader
	Err  chan error
}
func newSession(config *Config, conn io.ReadWriteCloser, client bool) *Session {
	s := &Session{
		config:     config,
		logger:     log.New(config.LogOutput, "", log.LstdFlags),
		conn:       conn,
		bufRead:    bufio.NewReader(conn),
		pings:      make(map[uint32]chan struct{}),
		streams:    make(map[uint32]*Stream),
		inflight:   make(map[uint32]struct{}),
		synCh:      make(chan struct{}, config.AcceptBacklog),
		acceptCh:   make(chan *Stream, config.AcceptBacklog),
		sendCh:     make(chan sendReady, 64),
		recvDoneCh: make(chan struct{}),
		shutdownCh: make(chan struct{}),
	}
	if client {
		s.nextStreamID = 1
	} else {
		s.nextStreamID = 2
	}
	go s.recv()
	go s.send()
	if config.EnableKeepAlive {
		go s.keepalive()
	}
	return s
}
func (s *Session) IsClosed() bool {
	select {
	case <-s.shutdownCh:
		return true
	default:
		return false
	}
}