From 9196d698eba4207d166c11d6216fe23ae830b888 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Mon, 21 Aug 2023 15:29:32 +0800 Subject: [PATCH] Fix incorrect CHECK during client-side early pull --- src/net/tools/naive/naive_connection.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/net/tools/naive/naive_connection.cc b/src/net/tools/naive/naive_connection.cc index 86f129a707..fb218b353a 100644 --- a/src/net/tools/naive/naive_connection.cc +++ b/src/net/tools/naive/naive_connection.cc @@ -301,12 +301,13 @@ int NaiveConnection::DoConnectServerComplete(int result) { } int NaiveConnection::Run(CompletionOnceCallback callback) { - DCHECK(sockets_[kClient]); DCHECK(sockets_[kServer]); DCHECK_EQ(next_state_, STATE_NONE); DCHECK(!connect_callback_); - if (errors_[kClient] != OK) + // The client-side socket may be closed before the server-side + // socket is connected. + if (errors_[kClient] != OK || sockets_[kClient] == nullptr) return errors_[kClient]; if (errors_[kServer] != OK) return errors_[kServer];