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

Issue 11417116: Fix secure socket tests to close sockets after writing. Fix handling of close events in TlsSocket … (Closed)

Created:
8 years, 1 month ago by Bill Hesse
Modified:
8 years, 1 month ago
Reviewers:
Mads Ager (google)
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fix secure socket tests to close sockets after writing. Fix handling of close events in TlsSocket class. BUG= Committed: https://code.google.com/p/dart/source/detail?r=15265

Patch Set 1 #

Patch Set 2 : Improve comments and code. #

Total comments: 6

Patch Set 3 : Address comments. #

Patch Set 4 : Fixed issue with incomplete writes in socket tests. #

Total comments: 2

Patch Set 5 : Address comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+150 lines, -71 lines) Patch
M sdk/lib/io/tls_socket.dart View 1 2 3 4 13 chunks +111 lines, -48 lines 0 comments Download
M tests/standalone/io/tls_server_test.dart View 1 2 3 2 chunks +24 lines, -18 lines 0 comments Download
M tests/standalone/io/tls_socket_test.dart View 1 2 3 3 chunks +15 lines, -5 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Bill Hesse
8 years, 1 month ago (2012-11-21 15:46:09 UTC) #1
Mads Ager (google)
https://codereview.chromium.org/11417116/diff/2001/sdk/lib/io/tls_socket.dart File sdk/lib/io/tls_socket.dart (right): https://codereview.chromium.org/11417116/diff/2001/sdk/lib/io/tls_socket.dart#newcode233 sdk/lib/io/tls_socket.dart:233: _socketWriteHandler = null; I don't understand this change. Why ...
8 years, 1 month ago (2012-11-21 16:06:31 UTC) #2
Bill Hesse
https://codereview.chromium.org/11417116/diff/2001/sdk/lib/io/tls_socket.dart File sdk/lib/io/tls_socket.dart (right): https://codereview.chromium.org/11417116/diff/2001/sdk/lib/io/tls_socket.dart#newcode233 sdk/lib/io/tls_socket.dart:233: _socketWriteHandler = null; On 2012/11/21 16:06:31, Mads Ager wrote: ...
8 years, 1 month ago (2012-11-21 16:25:25 UTC) #3
Bill Hesse
I also fixed the issue with incomplete writes, by adding a helper function WriteAndClose to ...
8 years, 1 month ago (2012-11-21 17:30:40 UTC) #4
Mads Ager (google)
8 years, 1 month ago (2012-11-22 10:04:16 UTC) #5
LGTM

https://codereview.chromium.org/11417116/diff/2001/sdk/lib/io/tls_socket.dart
File sdk/lib/io/tls_socket.dart (right):

https://codereview.chromium.org/11417116/diff/2001/sdk/lib/io/tls_socket.dart...
sdk/lib/io/tls_socket.dart:233: _socketWriteHandler = null;
On 2012/11/21 16:25:25, Bill Hesse wrote:
> On 2012/11/21 16:06:31, Mads Ager wrote:
> > I don't understand this change. Why would you want to get rid of the socket
> > write handler here?
> 
> The onWrite handler is a one-shot handler, that is reset to null after being
> called.  This is in the documentation of the Socket class.  It was a mistake
> that we were potentially calling it multiple times here. 
> 
> There was an error here, in that it should be possible to reset the write
> handler from the write handler.  Fixed.
> There is another potential bug:
>  I have now added a check here that it is possible to write to the plaintext
> write buffer here.

Thanks, that's right. I keep forgetting that the writeHandler is one-shot. With
the new event-handling system I think this should just be a stream that you need
to subscribe to and unsubscribe from like any other stream. But this is right
for this change. :)

https://codereview.chromium.org/11417116/diff/9001/sdk/lib/io/tls_socket.dart
File sdk/lib/io/tls_socket.dart (right):

https://codereview.chromium.org/11417116/diff/9001/sdk/lib/io/tls_socket.dart...
sdk/lib/io/tls_socket.dart:231: if (_socketWriteHandler != null &&
Combine this with the else if?

else if (status == CONNECTED &&
         _socketWriteHandler != null &&
         _tlsFilter.... > 0) {
  doStuff();
}

https://codereview.chromium.org/11417116/diff/9001/sdk/lib/io/tls_socket.dart...
sdk/lib/io/tls_socket.dart:235: _socketWriteHandler = null;  // Reset the
one-shot handler.
nit: I prefer the comment on the line before.

Powered by Google App Engine
This is Rietveld 408576698