jpillora / chisel

A fast TCP/UDP tunnel over HTTP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when channel is closed, outbound always by use

maxiloEmmmm opened this issue · comments

maybe rm outbound when req chan close?
like this

move set outbound nil to func

func (u *udpListener) unsetUDPChan(sshConn ssh.Conn) {

func (u *udpListener) unsetUDPChan(sshConn ssh.Conn) {
	sshConn.Wait()
	u.onLoseChannel()
}

func (u *udpListener) onLoseChannel() {
	u.Debugf("lost channel")
	u.outboundMut.Lock()
	u.outbound = nil
	u.outboundMut.Unlock()
}

call onLoseChannel after chan close

go ssh.DiscardRequests(reqs)

go func() {
  ssh.DiscardRequests(reqs)
  // channel done...
  u.onLoseChannel()
}()