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 // The close queue handles graceful closing of HTTP connections. When | 7 // The close queue handles graceful closing of HTTP connections. When |
8 // a connection is added to the queue it will enter a wait state | 8 // a connection is added to the queue it will enter a wait state |
9 // waiting for all data written and possibly socket shutdown from | 9 // waiting for all data written and possibly socket shutdown from |
10 // peer. | 10 // peer. |
(...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 } | 1910 } |
1911 | 1911 |
1912 set sendClientCertificate(bool send) => _sendClientCertificate = send; | 1912 set sendClientCertificate(bool send) => _sendClientCertificate = send; |
1913 | 1913 |
1914 set clientCertificate(String nickname) => _clientCertificate = nickname; | 1914 set clientCertificate(String nickname) => _clientCertificate = nickname; |
1915 | 1915 |
1916 set findProxy(String f(Uri uri)) => _findProxy = f; | 1916 set findProxy(String f(Uri uri)) => _findProxy = f; |
1917 | 1917 |
1918 void shutdown({bool force: false}) { | 1918 void shutdown({bool force: false}) { |
1919 if (force) _closeQueue.shutdown(); | 1919 if (force) _closeQueue.shutdown(); |
1920 _openSockets.forEach((String key, Queue<_SocketConnection> connections) { | 1920 new Map.from(_openSockets).forEach( |
| 1921 (String key, Queue<_SocketConnection> connections) { |
1921 while (!connections.isEmpty) { | 1922 while (!connections.isEmpty) { |
1922 _SocketConnection socketConn = connections.removeFirst(); | 1923 _SocketConnection socketConn = connections.removeFirst(); |
1923 socketConn._socket.close(); | 1924 socketConn._socket.close(); |
1924 } | 1925 } |
1925 }); | 1926 }); |
1926 if (force) { | 1927 if (force) { |
1927 _activeSockets.forEach((_SocketConnection socketConn) { | 1928 _activeSockets.toList().forEach((_SocketConnection socketConn) { |
1928 socketConn._httpClientConnection._onClientShutdown(); | 1929 socketConn._httpClientConnection._onClientShutdown(); |
1929 socketConn._close(); | 1930 socketConn._close(); |
1930 }); | 1931 }); |
1931 } | 1932 } |
1932 if (_evictionTimer != null) _cancelEvictionTimer(); | 1933 if (_evictionTimer != null) _cancelEvictionTimer(); |
1933 _shutdown = true; | 1934 _shutdown = true; |
1934 } | 1935 } |
1935 | 1936 |
1936 void _cancelEvictionTimer() { | 1937 void _cancelEvictionTimer() { |
1937 _evictionTimer.cancel(); | 1938 _evictionTimer.cancel(); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2324 | 2325 |
2325 | 2326 |
2326 class _RedirectInfo implements RedirectInfo { | 2327 class _RedirectInfo implements RedirectInfo { |
2327 const _RedirectInfo(int this.statusCode, | 2328 const _RedirectInfo(int this.statusCode, |
2328 String this.method, | 2329 String this.method, |
2329 Uri this.location); | 2330 Uri this.location); |
2330 final int statusCode; | 2331 final int statusCode; |
2331 final String method; | 2332 final String method; |
2332 final Uri location; | 2333 final Uri location; |
2333 } | 2334 } |
OLD | NEW |