IsDone reports whether both FIN frames (sent and received) have flowed, OR whether we sent our FIN but the peer's FIN never arrived within sessionFinalTimeout. The timeout prevents orphaned sessions from accumulating in the carrier's session map when a relay response carrying the peer's FIN is dropp
()
| 239 | // in the carrier's session map when a relay response carrying the peer's FIN |
| 240 | // is dropped. |
| 241 | func (s *Session) IsDone() bool { |
| 242 | s.mu.Lock() |
| 243 | defer s.mu.Unlock() |
| 244 | if s.finSent && s.rxClosed { |
| 245 | return true |
| 246 | } |
| 247 | // Reap orphaned sessions: we sent our FIN but never received the peer's. |
| 248 | if s.finSent && !s.finSentAt.IsZero() && time.Since(s.finSentAt) > sessionFinalTimeout { |
| 249 | return true |
| 250 | } |
| 251 | return false |
| 252 | } |
| 253 | |
| 254 | // DrainSnapshot captures the pre-drain state of a session so the caller can |
| 255 | // roll back via RollbackDrain if the batch carrying the drained frames cannot |
no outgoing calls
no test coverage detected