func (n *NetworkStreamSession) Close() {
	defer logger.Debugf("Closing session [%s]", n.sessionID)
	n.node.sessionsMutex.Lock()
	toClose := make([]*streamHandler, 0, len(n.streams))
	for stream := range n.streams {
		stream.refCtr--
		if stream.refCtr == 0 {
			toClose = append(toClose, stream)
		}
	}
	n.node.sessionsMutex.Unlock()
	logger.Debugf("Closing session stream [%s]", n.sessionID)
	for _, stream := range toClose {
		stream.close()
	}
	logger.Debugf("Closing session incoming [%s]", n.sessionID)
	close(n.incoming)
	n.closed = true
	logger.Debugf("Closing session [%s] done", n.sessionID)
}
Close releases all the resources allocated by this session
package comm
import (
	"sync"
	"github.com/hyperledger-labs/fabric-smart-client/platform/view/view"
)
type NetworkStreamSession struct {
	node            *P2PNode
	endpointID      []byte
	endpointAddress string
	contextID       string
	sessionID       string
	caller          view.Identity
	callerViewID    string
	incoming        chan *view.Message
	streams         map[*streamHandler]struct{}
	closed          bool
	mutex           sync.Mutex
}
func (n *NetworkStreamSession) Info() view.SessionInfo {
	n.mutex.Lock()
	ret := view.SessionInfo{
		ID:           n.sessionID,
		Caller:       n.caller,
		CallerViewID: n.callerViewID,
		Endpoint:     n.endpointAddress,
		EndpointPKID: n.endpointID,
		Closed:       n.closed,
	}
	n.mutex.Unlock()
	return ret
}
func (n *NetworkStreamSession) Send(payload []byte) error {
	return n.sendWithStatus(payload, view.OK)
}
func (n *NetworkStreamSession) SendError(payload []byte) error {
	return n.sendWithStatus(payload, view.ERROR)
}
func (n *NetworkStreamSession) Receive() <-chan *view.Message {
	return n.incoming
}