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

Side by Side Diff: sdk/lib/io/secure_server_socket.dart

Issue 18029005: dart:io | Handle an immediately closed connection in RawSecureServerSocket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * The [SecureServerSocket] is a server socket, providing a stream of high-level 8 * The [SecureServerSocket] is a server socket, providing a stream of high-level
9 * [Socket]s. 9 * [Socket]s.
10 * 10 *
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 /** 206 /**
207 * Closes the socket. 207 * Closes the socket.
208 */ 208 */
209 void close() { 209 void close() {
210 _closed = true; 210 _closed = true;
211 _socket.close(); 211 _socket.close();
212 } 212 }
213 213
214 void _onData(RawSocket connection) { 214 void _onData(RawSocket connection) {
215 var remotePort;
216 try {
217 remotePort = connection.remotePort;
218 } catch (e) {
219 // If connection is already closed, remotePort throws an exception.
220 // Do nothing - connection is closed.
221 return;
222 }
215 _RawSecureSocket.connect( 223 _RawSecureSocket.connect(
216 connection.address, 224 connection.address,
217 connection.remotePort, 225 remotePort,
218 certificateName, 226 certificateName,
219 is_server: true, 227 is_server: true,
220 socket: connection, 228 socket: connection,
221 requestClientCertificate: requestClientCertificate, 229 requestClientCertificate: requestClientCertificate,
222 requireClientCertificate: requireClientCertificate) 230 requireClientCertificate: requireClientCertificate)
223 .then((RawSecureSocket secureConnection) { 231 .then((RawSecureSocket secureConnection) {
224 if (_closed) { 232 if (_closed) {
225 secureConnection.close(); 233 secureConnection.close();
226 } else { 234 } else {
227 _controller.add(secureConnection); 235 _controller.add(secureConnection);
(...skipping 26 matching lines...) Expand all
254 _subscription = _socket.listen(_onData, 262 _subscription = _socket.listen(_onData,
255 onDone: _onDone, 263 onDone: _onDone,
256 onError: _onError); 264 onError: _onError);
257 } else { 265 } else {
258 close(); 266 close();
259 } 267 }
260 } 268 }
261 } 269 }
262 270
263 271
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698