Index: sdk/lib/io/http_session.dart |
diff --git a/sdk/lib/io/http_session.dart b/sdk/lib/io/http_session.dart |
index 1b049e395d8f8eb2e74823a57bbe1a6efa3a89fd..9d87ae9fb86be095abb4caad95c4ccaec83e4be9 100644 |
--- a/sdk/lib/io/http_session.dart |
+++ b/sdk/lib/io/http_session.dart |
@@ -18,11 +18,11 @@ class _HttpSession implements HttpSession { |
// Pointers in timeout queue. |
_HttpSession _prev; |
_HttpSession _next; |
+ final String id; |
final Map _data = new HashMap(); |
- _HttpSession(_HttpSessionManager this._sessionManager, String this.id) |
- : _lastSeen = new DateTime.now(); |
+ _HttpSession(this._sessionManager, this.id) : _lastSeen = new DateTime.now(); |
void destroy() { |
_destroyed = true; |
@@ -41,8 +41,6 @@ class _HttpSession implements HttpSession { |
bool get isNew => _isNew; |
- final String id; |
- |
void set onTimeout(void callback()) { |
_timeoutCallback = callback; |
} |
@@ -70,6 +68,12 @@ class _HttpSession implements HttpSession { |
// * In a map, mapping from ID to HttpSession. |
// * In a linked list, used as a timeout queue. |
class _HttpSessionManager { |
+ Map<String, _HttpSession> _sessions; |
+ int _sessionTimeout = 20 * 60; // 20 mins. |
+ _HttpSession _head; |
+ _HttpSession _tail; |
+ Timer _timer; |
+ |
_HttpSessionManager() : _sessions = {}; |
String createSessionId() { |
@@ -78,9 +82,7 @@ class _HttpSessionManager { |
return _CryptoUtils.bytesToHex(data); |
} |
- _HttpSession getSession(String id) { |
- return _sessions[id]; |
- } |
+ _HttpSession getSession(String id) => _sessions[id]; |
_HttpSession createSession() { |
var id = createSessionId(); |
@@ -100,9 +102,7 @@ class _HttpSessionManager { |
_startTimer(); |
} |
- void close() { |
- _stopTimer(); |
- } |
+ void close() => _stopTimer(); |
void _bumpToEnd(_HttpSession session) { |
_removeFromTimeoutQueue(session); |
@@ -168,11 +168,5 @@ class _HttpSessionManager { |
_timer = null; |
} |
} |
- |
- Map<String, _HttpSession> _sessions; |
- int _sessionTimeout = 20 * 60; // 20 mins. |
- _HttpSession _head; |
- _HttpSession _tail; |
- Timer _timer; |
} |