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

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

Issue 16363005: Ensure that only byte values are sent by sockets and web sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed a few bugs Created 7 years, 6 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 | sdk/lib/io/common.dart » ('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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 if (bytes < 0) throw new RangeError.value(bytes); 292 if (bytes < 0) throw new RangeError.value(bytes);
293 if ((offset + bytes) > buffer.length) { 293 if ((offset + bytes) > buffer.length) {
294 throw new RangeError.value(offset + bytes); 294 throw new RangeError.value(offset + bytes);
295 } 295 }
296 if (offset is! int || bytes is! int) { 296 if (offset is! int || bytes is! int) {
297 throw new ArgumentError("Invalid arguments to write on Socket"); 297 throw new ArgumentError("Invalid arguments to write on Socket");
298 } 298 }
299 if (isClosed) return 0; 299 if (isClosed) return 0;
300 if (bytes == 0) return 0; 300 if (bytes == 0) return 0;
301 _BufferAndStart bufferAndStart = 301 _BufferAndStart bufferAndStart =
302 _ensureFastAndSerializableBuffer(buffer, offset, offset + bytes); 302 _ensureFastAndSerializableByteData(buffer, offset, offset + bytes);
303 var result = 303 var result =
304 nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes); 304 nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes);
305 if (result is OSError) { 305 if (result is OSError) {
306 reportError(result, "Write failed"); 306 reportError(result, "Write failed");
307 result = 0; 307 result = 0;
308 } 308 }
309 return result; 309 return result;
310 } 310 }
311 311
312 _NativeSocket accept() { 312 _NativeSocket accept() {
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 if (_detachReady != null) { 1065 if (_detachReady != null) {
1066 _detachReady.complete(null); 1066 _detachReady.complete(null);
1067 } else { 1067 } else {
1068 if (_raw != null) { 1068 if (_raw != null) {
1069 _raw.shutdown(SocketDirection.SEND); 1069 _raw.shutdown(SocketDirection.SEND);
1070 _disableWriteEvent(); 1070 _disableWriteEvent();
1071 } 1071 }
1072 } 1072 }
1073 } 1073 }
1074 } 1074 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698