chisel icon indicating copy to clipboard operation
chisel copied to clipboard

when channel is closed, outbound always by use

Open maxiloEmmmm opened this issue 2 years ago • 0 comments

https://github.com/jpillora/chisel/blob/4eb9e6a87ff57d16c94fe01f98d31d455ab4f759/share/tunnel/tunnel_in_proxy_udp.go#L155

maybe rm outbound when req chan close? like this

move set outbound nil to func https://github.com/jpillora/chisel/blob/4eb9e6a87ff57d16c94fe01f98d31d455ab4f759/share/tunnel/tunnel_in_proxy_udp.go#L185

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 https://github.com/jpillora/chisel/blob/4eb9e6a87ff57d16c94fe01f98d31d455ab4f759/share/tunnel/tunnel_in_proxy_udp.go#L171

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

maxiloEmmmm avatar Sep 21 '23 11:09 maxiloEmmmm