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

Side by Side Diff: runtime/bin/socket_patch.dart

Issue 12393010: Fix socket so we stop the consumer before we close the socket - this makes sure we socket-close fut… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | tests/standalone/standalone.status » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 patch class RawServerSocket { 5 patch class RawServerSocket {
6 /* patch */ static Future<RawServerSocket> bind([String address = "127.0.0.1", 6 /* patch */ static Future<RawServerSocket> bind([String address = "127.0.0.1",
7 int port = 0, 7 int port = 0,
8 int backlog = 0]) { 8 int backlog = 0]) {
9 return _RawServerSocket.bind(address, port, backlog); 9 return _RawServerSocket.bind(address, port, backlog);
10 } 10 }
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 return _sink.addString(string, encoding); 778 return _sink.addString(string, encoding);
779 } 779 }
780 780
781 close() => _sink.close(); 781 close() => _sink.close();
782 782
783 Future<Socket> get done => _sink.done; 783 Future<Socket> get done => _sink.done;
784 784
785 void destroy() { 785 void destroy() {
786 // Destroy can always be called to get rid of a socket. 786 // Destroy can always be called to get rid of a socket.
787 if (_raw == null) return; 787 if (_raw == null) return;
788 _consumer.stop();
788 _closeRawSocket(); 789 _closeRawSocket();
789 _consumer.stop();
790 _controllerClosed = true; 790 _controllerClosed = true;
791 _controller.close(); 791 _controller.close();
792 } 792 }
793 793
794 int get port => _raw.port; 794 int get port => _raw.port;
795 String get remoteHost => _raw.remoteHost; 795 String get remoteHost => _raw.remoteHost;
796 int get remotePort => _raw.remotePort; 796 int get remotePort => _raw.remotePort;
797 797
798 // Ensure a subscription on the raw socket. Both the stream and the 798 // Ensure a subscription on the raw socket. Both the stream and the
799 // consumer needs a subscription as they share the error and done 799 // consumer needs a subscription as they share the error and done
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 _raw.onBadCertificate = callback; 921 _raw.onBadCertificate = callback;
922 } 922 }
923 923
924 X509Certificate get peerCertificate { 924 X509Certificate get peerCertificate {
925 if (_raw == null) { 925 if (_raw == null) {
926 throw new StateError("peerCertificate called on destroyed SecureSocket"); 926 throw new StateError("peerCertificate called on destroyed SecureSocket");
927 } 927 }
928 return _raw.peerCertificate; 928 return _raw.peerCertificate;
929 } 929 }
930 } 930 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698