| 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. |
| 11 class _HttpSession implements HttpSession { | 11 class _HttpSession implements HttpSession { |
| 12 // Destroyed marked. Used by the http connection to see if a session is valid. | 12 // Destroyed marked. Used by the http connection to see if a session is valid. |
| 13 bool _destroyed = false; | 13 bool _destroyed = false; |
| 14 bool _isNew = true; | 14 bool _isNew = true; |
| 15 DateTime _lastSeen; | 15 DateTime _lastSeen; |
| 16 Function _timeoutCallback; | 16 Function _timeoutCallback; |
| 17 _HttpSessionManager _sessionManager; | 17 _HttpSessionManager _sessionManager; |
| 18 // Pointers in timeout queue. | 18 // Pointers in timeout queue. |
| 19 _HttpSession _prev; | 19 _HttpSession _prev; |
| 20 _HttpSession _next; | 20 _HttpSession _next; |
| 21 | 21 |
| 22 final Map _data = new Map(); | 22 final Map _data = new HashMap(); |
| 23 | 23 |
| 24 _HttpSession(_HttpSessionManager this._sessionManager, String this.id) | 24 _HttpSession(_HttpSessionManager this._sessionManager, String this.id) |
| 25 : _lastSeen = new DateTime.now(); | 25 : _lastSeen = new DateTime.now(); |
| 26 | 26 |
| 27 void destroy() { | 27 void destroy() { |
| 28 _destroyed = true; | 28 _destroyed = true; |
| 29 _sessionManager._removeFromTimeoutQueue(this); | 29 _sessionManager._removeFromTimeoutQueue(this); |
| 30 _sessionManager._sessions.remove(id); | 30 _sessionManager._sessions.remove(id); |
| 31 } | 31 } |
| 32 | 32 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 Map<String, _HttpSession> _sessions; | 172 Map<String, _HttpSession> _sessions; |
| 173 int _sessionTimeout = 20 * 60; // 20 mins. | 173 int _sessionTimeout = 20 * 60; // 20 mins. |
| 174 _HttpSession _head; | 174 _HttpSession _head; |
| 175 _HttpSession _tail; | 175 _HttpSession _tail; |
| 176 Timer _timer; | 176 Timer _timer; |
| 177 } | 177 } |
| 178 | 178 |
| OLD | NEW |