Fix for ConnDead status

This commit is contained in:
Russ Magee 2023-11-06 21:57:19 -08:00
parent 9244cc9785
commit 908a1bcda2
4 changed files with 18 additions and 12 deletions

View file

@ -1339,7 +1339,8 @@ func (hc *Conn) Read(b []byte) (n int, err error) {
// Throw away pkt if it's chaff (ie., caller to Read() won't see this data)
log.Printf("[Chaff pkt, discarded (len %d)]\n", decryptN)
case CSOKeepAlive:
logger.LogDebug(fmt.Sprintf("[got keepAlive pkt, discarded (len %d)]\n", decryptN))
//logger.LogDebug(fmt.Sprintf("[got keepAlive pkt, discarded (len %d)]\n", decryptN))
// payload of keepalive (2 bytes) is not currently used (0x55aa fixed)
_ = binary.BigEndian.Uint16(payloadBytes[0:2])
hc.ResetKeepAlive()
case CSOTermSize:
@ -1625,7 +1626,6 @@ func (hc *Conn) StartupKeepAlive() {
func (hc *Conn) ShutdownKeepAlive() {
log.Println("Conn SHUTDOWN")
hc.SetStatus(CSEConnDead)
hc.Close()
}
@ -1655,6 +1655,7 @@ func (hc *Conn) keepaliveHelper() {
if hc.keepalive == 0 {
logger.LogDebug(fmt.Sprintf("*** keepaliveHelper shutting down\n"))
hc.SetStatus(CSEConnDead)
hc.ShutdownKeepAlive()
break
}