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

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

Issue 269003002: Fix crash in raw_secure_server_socket_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix status file. Created 6 years, 7 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 | « runtime/bin/eventhandler_win.cc ('k') | 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(address, 6 /* patch */ static Future<RawServerSocket> bind(address,
7 int port, 7 int port,
8 {int backlog: 0, 8 {int backlog: 0,
9 bool v6Only: false}) { 9 bool v6Only: false}) {
10 return _RawServerSocket.bind(address, port, backlog, v6Only); 10 return _RawServerSocket.bind(address, port, backlog, v6Only);
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 // events, and thus reporting of this error. 817 // events, and thus reporting of this error.
818 available = 1; 818 available = 1;
819 } 819 }
820 issueReadEvent(); 820 issueReadEvent();
821 continue; 821 continue;
822 } 822 }
823 } 823 }
824 824
825 var handler = eventHandlers[i]; 825 var handler = eventHandlers[i];
826 if (i == DESTROYED_EVENT) { 826 if (i == DESTROYED_EVENT) {
827 assert(isClosing);
827 assert(!isClosed); 828 assert(!isClosed);
828 isClosed = true; 829 isClosed = true;
829 closeCompleter.complete(); 830 closeCompleter.complete();
830 disconnectFromEventHandler(); 831 disconnectFromEventHandler();
831 if (handler != null) handler(); 832 if (handler != null) handler();
832 continue; 833 continue;
833 } 834 }
834 835
835 if (i == ERROR_EVENT) { 836 if (i == ERROR_EVENT) {
836 if (!isClosing) { 837 if (!isClosing) {
(...skipping 29 matching lines...) Expand all
866 eventHandlers[ERROR_EVENT] = error; 867 eventHandlers[ERROR_EVENT] = error;
867 eventHandlers[CLOSED_EVENT] = closed; 868 eventHandlers[CLOSED_EVENT] = closed;
868 eventHandlers[DESTROYED_EVENT] = destroyed; 869 eventHandlers[DESTROYED_EVENT] = destroyed;
869 } 870 }
870 871
871 void setListening({read: true, write: true}) { 872 void setListening({read: true, write: true}) {
872 sendReadEvents = read; 873 sendReadEvents = read;
873 sendWriteEvents = write; 874 sendWriteEvents = write;
874 if (read) issueReadEvent(); 875 if (read) issueReadEvent();
875 if (write) issueWriteEvent(); 876 if (write) issueWriteEvent();
876 if (eventPort == null) { 877 if (eventPort == null && !isClosing) {
877 int flags = typeFlags & TYPE_TYPE_MASK; 878 int flags = typeFlags & TYPE_TYPE_MASK;
878 if (!isClosedRead) flags |= 1 << READ_EVENT; 879 if (!isClosedRead) flags |= 1 << READ_EVENT;
879 if (!isClosedWrite) flags |= 1 << WRITE_EVENT; 880 if (!isClosedWrite) flags |= 1 << WRITE_EVENT;
880 sendToEventHandler(flags); 881 sendToEventHandler(flags);
881 } 882 }
882 } 883 }
883 884
884 Future close() { 885 Future close() {
885 if (!isClosing && !isClosed) { 886 if (!isClosing && !isClosed) {
886 sendToEventHandler(1 << CLOSE_COMMAND); 887 sendToEventHandler(1 << CLOSE_COMMAND);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 } 930 }
930 } 931 }
931 932
932 void sendToEventHandler(int data) { 933 void sendToEventHandler(int data) {
933 assert(!isClosing); 934 assert(!isClosing);
934 connectToEventHandler(); 935 connectToEventHandler();
935 _EventHandler._sendData(this, eventPort, data); 936 _EventHandler._sendData(this, eventPort, data);
936 } 937 }
937 938
938 void connectToEventHandler() { 939 void connectToEventHandler() {
940 assert(!isClosed);
939 if (eventPort == null) { 941 if (eventPort == null) {
940 eventPort = new RawReceivePort(multiplex); 942 eventPort = new RawReceivePort(multiplex);
941 _SocketsObservatory.add(this); 943 _SocketsObservatory.add(this);
942 } 944 }
943 } 945 }
944 946
945 void disconnectFromEventHandler() { 947 void disconnectFromEventHandler() {
946 assert(eventPort != null); 948 assert(eventPort != null);
947 eventPort.close(); 949 eventPort.close();
948 eventPort = null; 950 eventPort = null;
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 String address, 1795 String address,
1794 List<int> in_addr, 1796 List<int> in_addr,
1795 int port) { 1797 int port) {
1796 return new Datagram( 1798 return new Datagram(
1797 data, 1799 data,
1798 new _InternetAddress(address, null, in_addr), 1800 new _InternetAddress(address, null, in_addr),
1799 port); 1801 port);
1800 } 1802 }
1801 1803
1802 String _socketsStats() => _SocketsObservatory.toJSON(); 1804 String _socketsStats() => _SocketsObservatory.toJSON();
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_win.cc ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698