OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 5 |
6 final Map _servicePathMap = { | 6 final Map _servicePathMap = { |
7 'http' : { | 7 'http' : { |
8 'servers' : _httpServersServiceObject, | 8 'servers' : _httpServersServiceObject, |
| 9 'serverconnections' : _httpServerConnectionsServiceObject, |
9 }, | 10 }, |
10 'sockets' : _socketsServiceObject, | 11 'sockets' : _socketsServiceObject, |
11 'websockets' : _webSocketsServiceObject, | 12 'websockets' : _webSocketsServiceObject, |
12 'file' : { | 13 'file' : { |
13 'randomaccessfiles' : _randomAccessFilesServiceObject | 14 'randomaccessfiles' : _randomAccessFilesServiceObject |
14 }, | 15 }, |
15 'processes' : _processesServiceObject, | 16 'processes' : _processesServiceObject, |
16 }; | 17 }; |
17 | 18 |
18 String _getServicePath(obj) => obj._servicePath; | 19 String _getServicePath(obj) => obj._servicePath; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return server._toJSON(false); | 81 return server._toJSON(false); |
81 } | 82 } |
82 return { | 83 return { |
83 'id': 'io/http/servers', | 84 'id': 'io/http/servers', |
84 'type': 'HttpServerList', | 85 'type': 'HttpServerList', |
85 'members': _HttpServer._servers.values | 86 'members': _HttpServer._servers.values |
86 .map((server) => server._toJSON(true)).toList(), | 87 .map((server) => server._toJSON(true)).toList(), |
87 }; | 88 }; |
88 } | 89 } |
89 | 90 |
| 91 Map _httpServerConnectionsServiceObject(args) { |
| 92 if (args.length == 1) { |
| 93 var connection = _HttpConnection._connections[int.parse(args.first)]; |
| 94 if (connection == null) { |
| 95 return {}; |
| 96 } |
| 97 return connection._toJSON(false); |
| 98 } |
| 99 return _makeServiceError("http/serverconnections can not be listed"); |
| 100 } |
| 101 |
90 Map _socketsServiceObject(args) { | 102 Map _socketsServiceObject(args) { |
91 if (args.length == 1) { | 103 if (args.length == 1) { |
92 var socket = _NativeSocket._sockets[int.parse(args.first)]; | 104 var socket = _NativeSocket._sockets[int.parse(args.first)]; |
93 if (socket == null) { | 105 if (socket == null) { |
94 return {}; | 106 return {}; |
95 } | 107 } |
96 return socket._toJSON(false); | 108 return socket._toJSON(false); |
97 } | 109 } |
98 return { | 110 return { |
99 'id': 'io/sockets', | 111 'id': 'io/sockets', |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 155 } |
144 return process._toJSON(false); | 156 return process._toJSON(false); |
145 } | 157 } |
146 return { | 158 return { |
147 'id': 'io/processes', | 159 'id': 'io/processes', |
148 'type': 'ProcessList', | 160 'type': 'ProcessList', |
149 'members': _ProcessImpl._processes.values | 161 'members': _ProcessImpl._processes.values |
150 .map((p) => p._toJSON(true)).toList(), | 162 .map((p) => p._toJSON(true)).toList(), |
151 }; | 163 }; |
152 } | 164 } |
OLD | NEW |