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

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

Issue 297213005: Add Socket ref to HttpServer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Deploy 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/vmservice/client/lib/src/elements/service_view.dart ('k') | 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) 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 part of dart.io; 5 part of dart.io;
6 6
7 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; 7 const int _OUTGOING_BUFFER_SIZE = 8 * 1024;
8 8
9 class _HttpIncoming extends Stream<List<int>> { 9 class _HttpIncoming extends Stream<List<int>> {
10 final int _transferLength; 10 final int _transferLength;
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 } 2034 }
2035 2035
2036 2036
2037 // HTTP server waiting for socket connections. 2037 // HTTP server waiting for socket connections.
2038 class _HttpServer 2038 class _HttpServer
2039 extends Stream<HttpRequest> with _ServiceObject 2039 extends Stream<HttpRequest> with _ServiceObject
2040 implements HttpServer { 2040 implements HttpServer {
2041 // Use default Map so we keep order. 2041 // Use default Map so we keep order.
2042 static Map<int, _HttpServer> _servers = new Map<int, _HttpServer>(); 2042 static Map<int, _HttpServer> _servers = new Map<int, _HttpServer>();
2043 2043
2044 final String _serviceTypePath = 'io/http/servers';
2045 final String _serviceTypeName = 'HttpServer';
2046
2047 String serverHeader; 2044 String serverHeader;
2048 2045
2049 Duration _idleTimeout; 2046 Duration _idleTimeout;
2050 Timer _idleTimer; 2047 Timer _idleTimer;
2051 2048
2052 static Future<HttpServer> bind(address, int port, int backlog) { 2049 static Future<HttpServer> bind(address, int port, int backlog) {
2053 return ServerSocket.bind(address, port, backlog: backlog).then((socket) { 2050 return ServerSocket.bind(address, port, backlog: backlog).then((socket) {
2054 return new _HttpServer._(socket, true); 2051 return new _HttpServer._(socket, true);
2055 }); 2052 });
2056 } 2053 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 result.closing++; 2216 result.closing++;
2220 } 2217 }
2221 }); 2218 });
2222 _idleConnections.forEach((_HttpConnection conn) { 2219 _idleConnections.forEach((_HttpConnection conn) {
2223 result.idle++; 2220 result.idle++;
2224 assert(conn._isIdle); 2221 assert(conn._isIdle);
2225 }); 2222 });
2226 return result; 2223 return result;
2227 } 2224 }
2228 2225
2226 String get _serviceTypePath => 'io/http/servers';
2227 String get _serviceTypeName => 'HttpServer';
2228
2229 Map _toJSON(bool ref) { 2229 Map _toJSON(bool ref) {
2230 var r = { 2230 var r = {
2231 'id': _servicePath, 2231 'id': _servicePath,
2232 'type': _serviceType(ref), 2232 'type': _serviceType(ref),
2233 'name': '${address.host}:$port', 2233 'name': '${address.host}:$port',
2234 'user_name': '${address.host}:$port', 2234 'user_name': '${address.host}:$port',
2235 }; 2235 };
2236 if (ref) { 2236 if (ref) {
2237 return r; 2237 return r;
2238 } 2238 }
2239 try {
2240 r['socket'] = _serverSocket._toJSON(true);
2241 } catch (_) {
2242 r['socket'] = {
2243 'id': _servicePath,
2244 'type': '@Socket',
2245 'name': 'UserSocket',
2246 'user_name': 'UserSocket',
2247 };
2248 }
2239 r['port'] = port; 2249 r['port'] = port;
2240 r['address'] = address.host; 2250 r['address'] = address.host;
2241 r['active'] = _activeConnections.length; 2251 r['active'] = _activeConnections.length;
2242 r['idle'] = _idleConnections.length; 2252 r['idle'] = _idleConnections.length;
2243 r['closed'] = closed; 2253 r['closed'] = closed;
2244 return r; 2254 return r;
2245 } 2255 }
2246 2256
2247 _HttpSessionManager _sessionManagerInstance; 2257 _HttpSessionManager _sessionManagerInstance;
2248 2258
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 const _RedirectInfo(this.statusCode, this.method, this.location); 2675 const _RedirectInfo(this.statusCode, this.method, this.location);
2666 } 2676 }
2667 2677
2668 String _getHttpVersion() { 2678 String _getHttpVersion() {
2669 var version = Platform.version; 2679 var version = Platform.version;
2670 // Only include major and minor version numbers. 2680 // Only include major and minor version numbers.
2671 int index = version.indexOf('.', version.indexOf('.') + 1); 2681 int index = version.indexOf('.', version.indexOf('.') + 1);
2672 version = version.substring(0, index); 2682 version = version.substring(0, index);
2673 return 'Dart/$version (dart:io)'; 2683 return 'Dart/$version (dart:io)';
2674 } 2684 }
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/elements/service_view.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698