| 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 const String _DART_SESSION_ID = "DARTSESSID"; | 7 const String _DART_SESSION_ID = "DARTSESSID"; |
| 8 | 8 |
| 9 // A _HttpSession is a node in a double-linked list, with _next and _prev being | 9 // A _HttpSession is a node in a double-linked list, with _next and _prev being |
| 10 // the previous and next pointers. | 10 // the previous and next pointers. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 operator [](key) => _data[key]; | 53 operator [](key) => _data[key]; |
| 54 void operator []=(key, value) { _data[key] = value; } | 54 void operator []=(key, value) { _data[key] = value; } |
| 55 putIfAbsent(key, ifAbsent) => _data.putIfAbsent(key, ifAbsent); | 55 putIfAbsent(key, ifAbsent) => _data.putIfAbsent(key, ifAbsent); |
| 56 remove(key) => _data.remove(key); | 56 remove(key) => _data.remove(key); |
| 57 void clear() => _data.clear(); | 57 void clear() => _data.clear(); |
| 58 void forEach(void f(key, value)) => _data.forEach(f); | 58 void forEach(void f(key, value)) => _data.forEach(f); |
| 59 Iterable get keys => _data.keys; | 59 Iterable get keys => _data.keys; |
| 60 Iterable get values => _data.values; | 60 Iterable get values => _data.values; |
| 61 int get length => _data.length; | 61 int get length => _data.length; |
| 62 bool get isEmpty => _data.isEmpty; | 62 bool get isEmpty => _data.isEmpty; |
| 63 bool get isNotEmpty => _data.isNotEmpty; |
| 63 } | 64 } |
| 64 | 65 |
| 65 // Private class used to manage all the active sessions. The sessions are stored | 66 // Private class used to manage all the active sessions. The sessions are stored |
| 66 // in two ways: | 67 // in two ways: |
| 67 // | 68 // |
| 68 // * In a map, mapping from ID to HttpSession. | 69 // * In a map, mapping from ID to HttpSession. |
| 69 // * In a linked list, used as a timeout queue. | 70 // * In a linked list, used as a timeout queue. |
| 70 class _HttpSessionManager { | 71 class _HttpSessionManager { |
| 71 _HttpSessionManager() : _sessions = {}; | 72 _HttpSessionManager() : _sessions = {}; |
| 72 | 73 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 168 } |
| 168 } | 169 } |
| 169 | 170 |
| 170 Map<String, _HttpSession> _sessions; | 171 Map<String, _HttpSession> _sessions; |
| 171 int _sessionTimeout = 20 * 60; // 20 mins. | 172 int _sessionTimeout = 20 * 60; // 20 mins. |
| 172 _HttpSession _head; | 173 _HttpSession _head; |
| 173 _HttpSession _tail; | 174 _HttpSession _tail; |
| 174 Timer _timer; | 175 Timer _timer; |
| 175 } | 176 } |
| 176 | 177 |
| OLD | NEW |