| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Global constants. | 5 // Global constants. |
| 6 class Const { | 6 class Const { |
| 7 // Bytes for "HTTP/1.0". | 7 // Bytes for "HTTP/1.0". |
| 8 static final HTTP10 = const [72, 84, 84, 80, 47, 49, 46, 48]; | 8 static final HTTP10 = const [72, 84, 84, 80, 47, 49, 46, 48]; |
| 9 // Bytes for "HTTP/1.1". | 9 // Bytes for "HTTP/1.1". |
| 10 static final HTTP11 = const [72, 84, 84, 80, 47, 49, 46, 49]; | 10 static final HTTP11 = const [72, 84, 84, 80, 47, 49, 46, 49]; |
| (...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 SocketConnection socketConn = connections.last(); | 1480 SocketConnection socketConn = connections.last(); |
| 1481 if (socketConn._idleTime(now).inMilliseconds > | 1481 if (socketConn._idleTime(now).inMilliseconds > |
| 1482 DEFAULT_EVICTION_TIMEOUT) { | 1482 DEFAULT_EVICTION_TIMEOUT) { |
| 1483 connections.removeLast(); | 1483 connections.removeLast(); |
| 1484 } else { | 1484 } else { |
| 1485 break; | 1485 break; |
| 1486 } | 1486 } |
| 1487 } | 1487 } |
| 1488 }); | 1488 }); |
| 1489 } | 1489 } |
| 1490 _evictionTimer = new Timer(_handleEviction, 10000, true); | 1490 _evictionTimer = new Timer.repeating(_handleEviction, 10000); |
| 1491 } | 1491 } |
| 1492 | 1492 |
| 1493 // Return connection. | 1493 // Return connection. |
| 1494 sockets.addFirst(socketConn); | 1494 sockets.addFirst(socketConn); |
| 1495 socketConn._markReturned(); | 1495 socketConn._markReturned(); |
| 1496 } | 1496 } |
| 1497 | 1497 |
| 1498 void set openHandler(void callback(HTTPClientRequest request)) { | 1498 void set openHandler(void callback(HTTPClientRequest request)) { |
| 1499 _openHandler = callback; | 1499 _openHandler = callback; |
| 1500 } | 1500 } |
| 1501 | 1501 |
| 1502 var _openHandler; | 1502 var _openHandler; |
| 1503 Map<String, Queue<SocketConnection>> _openSockets; | 1503 Map<String, Queue<SocketConnection>> _openSockets; |
| 1504 Timer _evictionTimer; | 1504 Timer _evictionTimer; |
| 1505 bool _shutdown; // Has this HTTP client been shutdown? | 1505 bool _shutdown; // Has this HTTP client been shutdown? |
| 1506 } | 1506 } |
| OLD | NEW |