| 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 putIfAbsent(key, ifAbsent) => _data.putIfAbsent(key, ifAbsent); | 53 putIfAbsent(key, ifAbsent) => _data.putIfAbsent(key, ifAbsent); |
| 54 addAll(Map other) => _data.addAll(other); | 54 addAll(Map other) => _data.addAll(other); |
| 55 remove(key) => _data.remove(key); | 55 remove(key) => _data.remove(key); |
| 56 void clear() => _data.clear(); | 56 void clear() => _data.clear(); |
| 57 void forEach(void f(key, value)) => _data.forEach(f); | 57 void forEach(void f(key, value)) => _data.forEach(f); |
| 58 Iterable get keys => _data.keys; | 58 Iterable get keys => _data.keys; |
| 59 Iterable get values => _data.values; | 59 Iterable get values => _data.values; |
| 60 int get length => _data.length; | 60 int get length => _data.length; |
| 61 bool get isEmpty => _data.isEmpty; | 61 bool get isEmpty => _data.isEmpty; |
| 62 bool get isNotEmpty => _data.isNotEmpty; | 62 bool get isNotEmpty => _data.isNotEmpty; |
| 63 |
| 64 String toString() => 'HttpSession id:$id $_data'; |
| 63 } | 65 } |
| 64 | 66 |
| 65 // Private class used to manage all the active sessions. The sessions are stored | 67 // Private class used to manage all the active sessions. The sessions are stored |
| 66 // in two ways: | 68 // in two ways: |
| 67 // | 69 // |
| 68 // * In a map, mapping from ID to HttpSession. | 70 // * In a map, mapping from ID to HttpSession. |
| 69 // * In a linked list, used as a timeout queue. | 71 // * In a linked list, used as a timeout queue. |
| 70 class _HttpSessionManager { | 72 class _HttpSessionManager { |
| 71 Map<String, _HttpSession> _sessions; | 73 Map<String, _HttpSession> _sessions; |
| 72 int _sessionTimeout = 20 * 60; // 20 mins. | 74 int _sessionTimeout = 20 * 60; // 20 mins. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 165 } |
| 164 | 166 |
| 165 void _stopTimer() { | 167 void _stopTimer() { |
| 166 if (_timer != null) { | 168 if (_timer != null) { |
| 167 _timer.cancel(); | 169 _timer.cancel(); |
| 168 _timer = null; | 170 _timer = null; |
| 169 } | 171 } |
| 170 } | 172 } |
| 171 } | 173 } |
| 172 | 174 |
| OLD | NEW |