Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Issue 2915243002: Fixing SSL error that occurs when underlying socket is blocked. (Closed)

Created:
3 years, 6 months ago by Taylor Brandstetter
Modified:
3 years, 6 months ago
Reviewers:
juberti1, pthatcher1
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com, kwiberg-webrtc
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Fixing SSL error that occurs when underlying socket is blocked. BoringSSL (or OpenSSL) require that when SSL_write fails due to the underlying socket being blocked, it's retried with the same parameters until it succeeds. But we weren't doing this, and our socket abstraction doesn't have an equivalent requirement. So when this was occurring, we would just end up trying to send the next RTP or STUN packet (instead of the packet that couldn't be sent), and BoringSSL doesn't like that. So, when this condition occurs now, we'll simply enter a "pending write" mode and buffer the data that couldn't be completely sent. When the underlying socket becomes writable again, or if Send is called again before that happens, we retry sending the buffered data. Making both BoringSSL and the upper layer of code that expects normal TCP socket behavior happy. Also adding some more logging, and fixing an issue with VirtualSocketServer that made it behave slightly differently than PhysicalSocketServer when a TCP packet is only partially read. BUG=webrtc:7753 Review-Url: https://codereview.webrtc.org/2915243002 Cr-Commit-Position: refs/heads/master@{#18416} Committed: https://chromium.googlesource.com/external/webrtc/+/ed3b986d63294d732cabe689e049b6e76d312980

Patch Set 1 #

Total comments: 30

Patch Set 2 : Responding to comments. #

Patch Set 3 : Get rid of outdated comment. #

Patch Set 4 : Send an additional message while socket is blocked. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+210 lines, -55 lines) Patch
M webrtc/base/openssladapter.h View 1 3 chunks +10 lines, -0 lines 0 comments Download
M webrtc/base/openssladapter.cc View 1 7 chunks +141 lines, -48 lines 2 comments Download
M webrtc/base/ssladapter_unittest.cc View 1 2 3 4 chunks +46 lines, -7 lines 0 comments Download
M webrtc/base/virtualsocketserver.cc View 1 3 chunks +13 lines, -0 lines 0 comments Download

Messages

Total messages: 25 (11 generated)
Taylor Brandstetter
PTAL
3 years, 6 months ago (2017-06-02 02:47:39 UTC) #2
pthatcher1
lgtm, with suggestions Mostly just style stuff, but there is an extra test situation that ...
3 years, 6 months ago (2017-06-02 04:58:22 UTC) #3
juberti1
https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/openssladapter.cc File webrtc/base/openssladapter.cc (right): https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/openssladapter.cc#newcode343 webrtc/base/openssladapter.cc:343: SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); From the chat with davidben, I'm not sure ...
3 years, 6 months ago (2017-06-02 05:35:44 UTC) #5
Taylor Brandstetter
Comments addressed. Probably worth another review. https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/openssladapter.cc File webrtc/base/openssladapter.cc (left): https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/openssladapter.cc#oldcode427 webrtc/base/openssladapter.cc:427: ssl_write_needs_read_ = false; ...
3 years, 6 months ago (2017-06-02 06:49:14 UTC) #7
pthatcher1
lgtm again, with one small thing https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/ssladapter_unittest.cc File webrtc/base/ssladapter_unittest.cc (right): https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/ssladapter_unittest.cc#newcode418 webrtc/base/ssladapter_unittest.cc:418: ASSERT_EQ(-1, rv); On ...
3 years, 6 months ago (2017-06-02 13:24:24 UTC) #12
pthatcher1
Actually, I just realized a potential problem: If we return the size buffered while caching ...
3 years, 6 months ago (2017-06-02 14:06:08 UTC) #13
pthatcher1
On 2017/06/02 14:06:08, pthatcher1 wrote: > Actually, I just realized a potential problem: > > ...
3 years, 6 months ago (2017-06-02 14:10:49 UTC) #14
Taylor Brandstetter
On 2017/06/02 14:06:08, pthatcher1 wrote: > Actually, I just realized a potential problem: > > ...
3 years, 6 months ago (2017-06-02 16:52:40 UTC) #15
Taylor Brandstetter
On 2017/06/02 14:10:49, pthatcher1 wrote: > > By the way, the only user of OpenSslAdapter ...
3 years, 6 months ago (2017-06-02 16:55:57 UTC) #16
Taylor Brandstetter
https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/ssladapter_unittest.cc File webrtc/base/ssladapter_unittest.cc (right): https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/ssladapter_unittest.cc#newcode418 webrtc/base/ssladapter_unittest.cc:418: ASSERT_EQ(-1, rv); On 2017/06/02 13:24:24, pthatcher1 wrote: > On ...
3 years, 6 months ago (2017-06-02 17:10:53 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2915243002/60001
3 years, 6 months ago (2017-06-02 17:11:06 UTC) #20
commit-bot: I haz the power
Committed patchset #4 (id:60001) as https://chromium.googlesource.com/external/webrtc/+/ed3b986d63294d732cabe689e049b6e76d312980
3 years, 6 months ago (2017-06-02 17:33:21 UTC) #23
juberti1
lgtm with nits https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/ssladapter_unittest.cc File webrtc/base/ssladapter_unittest.cc (right): https://codereview.webrtc.org/2915243002/diff/1/webrtc/base/ssladapter_unittest.cc#newcode396 webrtc/base/ssladapter_unittest.cc:396: TEST_F(SSLAdapterTestTLS_RSA, TestTLSTransferWithBlockedSocket) { On 2017/06/02 06:49:14, ...
3 years, 6 months ago (2017-06-02 17:47:23 UTC) #24
Taylor Brandstetter
3 years, 6 months ago (2017-06-02 18:18:42 UTC) #25
Message was sent while issue was closed.
https://codereview.webrtc.org/2915243002/diff/60001/webrtc/base/openssladapte...
File webrtc/base/openssladapter.cc (right):

https://codereview.webrtc.org/2915243002/diff/60001/webrtc/base/openssladapte...
webrtc/base/openssladapter.cc:569: pending_data_.empty()) {
On 2017/06/02 17:47:22, juberti1 wrote:
> Is it possible for pending_data_ to *not* be empty here?

Oh, it isn't possible now that this code was shuffled around. I'll make a
follow-up CL that adds a DCHECK.

Powered by Google App Engine
This is Rietveld 408576698