OLD | NEW |
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 class _HttpIncoming extends Stream<List<int>> { | 7 class _HttpIncoming extends Stream<List<int>> { |
8 final int _transferLength; | 8 final int _transferLength; |
9 final Completer _dataCompleter = new Completer(); | 9 final Completer _dataCompleter = new Completer(); |
10 Stream<List<int>> _stream; | 10 Stream<List<int>> _stream; |
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 _connections.add(connection); | 1752 _connections.add(connection); |
1753 }, | 1753 }, |
1754 onError: _controller.addError, | 1754 onError: _controller.addError, |
1755 onDone: _controller.close); | 1755 onDone: _controller.close); |
1756 return _controller.stream.listen(onData, | 1756 return _controller.stream.listen(onData, |
1757 onError: onError, | 1757 onError: onError, |
1758 onDone: onDone, | 1758 onDone: onDone, |
1759 cancelOnError: cancelOnError); | 1759 cancelOnError: cancelOnError); |
1760 } | 1760 } |
1761 | 1761 |
1762 void close() { | 1762 Future close() { |
1763 closed = true; | 1763 closed = true; |
| 1764 Future result; |
1764 if (_serverSocket != null && _closeServer) { | 1765 if (_serverSocket != null && _closeServer) { |
1765 _serverSocket.close(); | 1766 result = _serverSocket.close(); |
| 1767 } else { |
| 1768 result = new Future.value(); |
1766 } | 1769 } |
1767 if (_sessionManagerInstance != null) { | 1770 if (_sessionManagerInstance != null) { |
1768 _sessionManagerInstance.close(); | 1771 _sessionManagerInstance.close(); |
1769 _sessionManagerInstance = null; | 1772 _sessionManagerInstance = null; |
1770 } | 1773 } |
1771 for (_HttpConnection connection in _connections.toList()) { | 1774 for (_HttpConnection connection in _connections.toList()) { |
1772 connection.destroy(); | 1775 connection.destroy(); |
1773 } | 1776 } |
1774 _connections.clear(); | 1777 _connections.clear(); |
| 1778 return result; |
1775 } | 1779 } |
1776 | 1780 |
1777 int get port { | 1781 int get port { |
1778 if (closed) throw new HttpException("HttpServer is not bound to a socket"); | 1782 if (closed) throw new HttpException("HttpServer is not bound to a socket"); |
1779 return _serverSocket.port; | 1783 return _serverSocket.port; |
1780 } | 1784 } |
1781 | 1785 |
1782 set sessionTimeout(int timeout) { | 1786 set sessionTimeout(int timeout) { |
1783 _sessionManager.sessionTimeout = timeout; | 1787 _sessionManager.sessionTimeout = timeout; |
1784 } | 1788 } |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 | 2234 |
2231 | 2235 |
2232 class _RedirectInfo implements RedirectInfo { | 2236 class _RedirectInfo implements RedirectInfo { |
2233 const _RedirectInfo(int this.statusCode, | 2237 const _RedirectInfo(int this.statusCode, |
2234 String this.method, | 2238 String this.method, |
2235 Uri this.location); | 2239 Uri this.location); |
2236 final int statusCode; | 2240 final int statusCode; |
2237 final String method; | 2241 final String method; |
2238 final Uri location; | 2242 final Uri location; |
2239 } | 2243 } |
OLD | NEW |