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 new Map.from(_openSockets).forEach( | 1920 _openSockets.forEach((String key, Queue<_SocketConnection> connections) { |
1921 (String key, Queue<_SocketConnection> connections) { | |
1922 while (!connections.isEmpty) { | 1921 while (!connections.isEmpty) { |
1923 _SocketConnection socketConn = connections.removeFirst(); | 1922 _SocketConnection socketConn = connections.removeFirst(); |
1924 socketConn._socket.close(); | 1923 socketConn._socket.close(); |
1925 } | 1924 } |
1926 }); | 1925 }); |
1927 if (force) { | 1926 if (force) { |
1928 _activeSockets.toList().forEach((_SocketConnection socketConn) { | 1927 _activeSockets.forEach((_SocketConnection socketConn) { |
1929 socketConn._httpClientConnection._onClientShutdown(); | 1928 socketConn._httpClientConnection._onClientShutdown(); |
1930 socketConn._close(); | 1929 socketConn._close(); |
1931 }); | 1930 }); |
1932 } | 1931 } |
1933 if (_evictionTimer != null) _cancelEvictionTimer(); | 1932 if (_evictionTimer != null) _cancelEvictionTimer(); |
1934 _shutdown = true; | 1933 _shutdown = true; |
1935 } | 1934 } |
1936 | 1935 |
1937 void _cancelEvictionTimer() { | 1936 void _cancelEvictionTimer() { |
1938 _evictionTimer.cancel(); | 1937 _evictionTimer.cancel(); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 | 2324 |
2326 | 2325 |
2327 class _RedirectInfo implements RedirectInfo { | 2326 class _RedirectInfo implements RedirectInfo { |
2328 const _RedirectInfo(int this.statusCode, | 2327 const _RedirectInfo(int this.statusCode, |
2329 String this.method, | 2328 String this.method, |
2330 Uri this.location); | 2329 Uri this.location); |
2331 final int statusCode; | 2330 final int statusCode; |
2332 final String method; | 2331 final String method; |
2333 final Uri location; | 2332 final Uri location; |
2334 } | 2333 } |
OLD | NEW |