mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
sentry: skip waiting for undrain for netstack TCP endpoints in error state.
PiperOrigin-RevId: 224214981 Change-Id: I4c1dd5b1c856f7a4f9866a5dda44a5297e92486a
This commit is contained in:
@@ -976,25 +976,35 @@ func (e *endpoint) protocolMainLoop(handshake bool) *tcpip.Error {
|
||||
e.mu.Unlock()
|
||||
}
|
||||
if n¬ifyClose != 0 && closeTimer == nil {
|
||||
// Reset the connection 3 seconds after the
|
||||
// endpoint has been closed.
|
||||
// Reset the connection 3 seconds after
|
||||
// the endpoint has been closed.
|
||||
//
|
||||
// The timer could fire in background
|
||||
// when the endpoint is drained. That's
|
||||
// OK as the loop here will not honor
|
||||
// the firing until the undrain arrives.
|
||||
closeTimer = time.AfterFunc(3*time.Second, func() {
|
||||
closeWaker.Assert()
|
||||
})
|
||||
}
|
||||
|
||||
if n¬ifyKeepaliveChanged != 0 {
|
||||
// The timer could fire in background
|
||||
// when the endpoint is drained. That's
|
||||
// OK. See above.
|
||||
e.resetKeepaliveTimer(true)
|
||||
}
|
||||
|
||||
if n¬ifyDrain != 0 {
|
||||
for !e.segmentQueue.empty() {
|
||||
if err := e.handleSegments(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
close(e.drainDone)
|
||||
<-e.undrain
|
||||
}
|
||||
|
||||
if n¬ifyKeepaliveChanged != 0 {
|
||||
e.resetKeepaliveTimer(true)
|
||||
if e.state != stateError {
|
||||
close(e.drainDone)
|
||||
<-e.undrain
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user