From 709f2ae3dd4b5f5b91e92fed3b032321ad4ab8fb Mon Sep 17 00:00:00 2001 From: Russ Magee Date: Sun, 11 Nov 2018 21:55:21 -0800 Subject: [PATCH] Got rid of superfluous weAreDialled var Signed-off-by: Russ Magee --- hkexnet/hkextun.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hkexnet/hkextun.go b/hkexnet/hkextun.go index da2e3ce..c95a9a7 100644 --- a/hkexnet/hkextun.go +++ b/hkexnet/hkextun.go @@ -243,11 +243,10 @@ func (hc *Conn) StartServerTunnel(lport, rport uint16) { go func() { var wg sync.WaitGroup - weAreDialled := false for cmd := range (*hc.tuns)[rport].Ctl { var c net.Conn - logger.LogDebug(fmt.Sprintf("[ServerTun] got Ctl '%c'. weAreDialled: %v", cmd, weAreDialled)) - if cmd == 'd' && !weAreDialled { + logger.LogDebug(fmt.Sprintf("[ServerTun] got Ctl '%c'.", cmd)) + if cmd == 'd' { // if re-using tunnel, re-init it if (*hc.tuns)[rport] == nil { hc.InitTunEndpoint(lport, "", rport) @@ -262,7 +261,6 @@ func (hc *Conn) StartServerTunnel(lport, rport uint16) { hc.WritePacket(resp.Bytes(), CSOTunRefused) } else { logger.LogDebug(fmt.Sprintf("[ServerTun] Tunnel Opened - %v", (*hc.tuns)[rport])) - weAreDialled = true var resp bytes.Buffer binary.Write(&resp, binary.BigEndian, lport) binary.Write(&resp, binary.BigEndian, rport) @@ -279,7 +277,6 @@ func (hc *Conn) StartServerTunnel(lport, rport uint16) { if c.Close() != nil { logger.LogDebug("[ServerTun] workerA: conn c already closed") } - weAreDialled = false wg.Done() }() @@ -343,7 +340,6 @@ func (hc *Conn) StartServerTunnel(lport, rport uint16) { if c.Close() != nil { logger.LogDebug("[ServerTun] worker B: conn c already closed") } - weAreDialled = false wg.Done() }()