Skip to content

Commit 51aac62

Browse files
committed
Fix calling FinishClose multiple interleaving times
1 parent a452546 commit 51aac62

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/quic/session.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ namespace quic {
6363
V(DATAGRAM, datagram, uint8_t) \
6464
V(SESSION_TICKET, session_ticket, uint8_t) \
6565
V(CLOSING, closing, uint8_t) \
66+
V(FINISH_CLOSING, finish_closing, uint8_t) \
6667
V(GRACEFUL_CLOSE, graceful_close, uint8_t) \
6768
V(SILENT_CLOSE, silent_close, uint8_t) \
6869
V(STATELESS_RESET, stateless_reset, uint8_t) \
@@ -1401,7 +1402,7 @@ bool Session::is_destroyed_or_closing() const {
14011402

14021403
void Session::Close(CloseMethod method) {
14031404
if (is_destroyed()) return;
1404-
auto& stats_ = impl_->stats_;
1405+
// auto& stats_ = impl_->stats_;
14051406

14061407
if (impl_->last_error_) {
14071408
Debug(this, "Closing with error: %s", impl_->last_error_);
@@ -1458,6 +1459,8 @@ void Session::Close(CloseMethod method) {
14581459
}
14591460

14601461
void Session::FinishClose() {
1462+
if (impl_->state_->finish_closing) return; // we were already called, avoids calling it twice
1463+
impl_->state_->finish_closing = 1;
14611464
// FinishClose() should be called only after, and as a result of, Close()
14621465
// being called first.
14631466
DCHECK(!is_destroyed());

0 commit comments

Comments
 (0)