New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 704949 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 700617



Sign in to add a comment

Better API contract for QuicCryptoClientStream::CryptoConnect()

Project Member Reported by xunji...@chromium.org, Mar 24 2017

Issue description

This is filed to follow up on  Issue 700617 .

QuicCryptoClientStream::CryptoConnect() can fail synchronously. This is unexpected and not documented. This function used to return a bool (crrev.com/fbf7d6b0052f55f5eca633b72c5bb2c5c1e04b9a).

We could consider the following:
(1) Document this function in QuicCryptoClientStreamBase.
(2) Make the function return a bool so we can detect any synchronous error without resorting to an additional "connection()->connected()" check.
(3) Make the function additionally take in a callback. This might allow us to simplify caller code and get rid of some delegate callbacks. 


 

Comment 1 by rch@chromium.org, Mar 24 2017

Confusingly, it used to return bool but always returned true:

https://codereview.chromium.org/811973006/diff/1/net/quic/quic_crypto_client_stream.cc?context=10&column_width=80&tab_spaces=8

 125 bool QuicCryptoClientStream::CryptoConnect() {
 126   next_state_ = STATE_INITIALIZE;
 127   DoHandshakeLoop(nullptr);
 128   return true;	
 129 }

*Sigh*

In any case, doing 1 and 2 seem great. 3 would be problematic because of the code sharing involved.
Cc: zhongyi@chromium.org xunji...@chromium.org
 Issue 704649  has been merged into this issue.
Summary: Better API contract for QuicCryptoClientStream::CryptoConnect() (was: Better API contract for QuicCrytoClientStream::CryptoConnect())
Project Member

Comment 4 by bugdroid1@chromium.org, Apr 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e23ca12cab688382ed5a3e3350885bed0b9d39b4

commit e23ca12cab688382ed5a3e3350885bed0b9d39b4
Author: xunjieli <xunjieli@chromium.org>
Date: Mon Apr 03 22:23:27 2017

Check callback is run in QuicChromiumClientSession's destructor

Add a DCHECK to make sure |callback_| has been run in
QuicChromiumClientSession's destructor.

BUG= 704949 

Review-Url: https://codereview.chromium.org/2797443002
Cr-Commit-Position: refs/heads/master@{#461558}

[modify] https://crrev.com/e23ca12cab688382ed5a3e3350885bed0b9d39b4/net/quic/chromium/quic_chromium_client_session.cc

Project Member

Comment 5 by bugdroid1@chromium.org, Apr 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/53b0eeafd14a0a5699ff8850df41ddef696caddc

commit 53b0eeafd14a0a5699ff8850df41ddef696caddc
Author: xunjieli <xunjieli@chromium.org>
Date: Tue Apr 04 16:55:43 2017

Check callback is run in QuicStreamFactory::Job

This CL adds a DCHECK in QuicStreamFactory::Job's destructor to make sure
|callback_| has been run.

This CL clears two related classes's callback instances so we only run
them once.

BUG= 704949 

Review-Url: https://codereview.chromium.org/2794963002
Cr-Commit-Position: refs/heads/master@{#461753}

[modify] https://crrev.com/53b0eeafd14a0a5699ff8850df41ddef696caddc/net/http/http_stream_factory_impl_job_controller_unittest.cc
[modify] https://crrev.com/53b0eeafd14a0a5699ff8850df41ddef696caddc/net/quic/chromium/quic_stream_factory.cc

Status: Available (was: Untriaged)
Alright, I landed two small CLs to add DCHECKs as discussed. If we don't ever trigger them, they will at least make the assumptions obvious. 

I don't think I will get to the CryptoConnect() part. I will mark this one as Available.
Owner: zhongyi@chromium.org
Status: Assigned (was: Available)
So I have changed a API a little bit per #1: documented the function in QuicCryptoClientStreamBase, and make the function returns a boolean to indicate whether the connection is still connected. 

As rch@ has suggested, we might want to rename CryptoConnect to StartCryptoConnect which sounds more suitable for this function. 
Status: Fixed (was: Assigned)
Labels: sr-pm-5

Sign in to add a comment