Detect TCP connection issues immediately rather than waiting for tokens

legacy-v1
Qian Wang 5 years ago
parent ba7f29d9e6
commit 8317f447d1

@ -134,13 +134,13 @@ func (sb *switchboard) deplex(ce *connEnclave) {
buf := make([]byte, 20480)
for {
n, err := sb.session.obfsedRead(ce.remoteConn, buf)
sb.rxWait(n)
if err != nil {
//log.Println(err)
go ce.remoteConn.Close()
sb.removeConn(ce)
return
}
sb.rxWait(n)
if sb.AddRxCredit(-int64(n)) < 0 {
log.Println(ErrNoRxCredit)
sb.session.Close()

Loading…
Cancel
Save