diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2011-03-29 13:49:49 -0700 |
|---|---|---|
| committer | Anthony Young <sleepsonthefloor@gmail.com> | 2011-03-29 13:49:49 -0700 |
| commit | 817572265871fd2cfd1252dd0cffb167f0e2ccdb (patch) | |
| tree | 6984b0406cd2bf112dc4fff2ebf1a549a8291a1c | |
| parent | cc7ba9a7a4ed8a38f217ad7f33fc33254f80ead7 (diff) | |
| download | nova-817572265871fd2cfd1252dd0cffb167f0e2ccdb.tar.gz nova-817572265871fd2cfd1252dd0cffb167f0e2ccdb.tar.xz nova-817572265871fd2cfd1252dd0cffb167f0e2ccdb.zip | |
move functions around
| -rw-r--r-- | nova/vnc/auth.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/nova/vnc/auth.py b/nova/vnc/auth.py index fd8d351f1..86efffbe6 100644 --- a/nova/vnc/auth.py +++ b/nova/vnc/auth.py @@ -44,18 +44,7 @@ class VNCNovaAuthMiddleware(object): def __init__(self, app): self.app = app self.token_cache = {} - utils.LoopingCall(self._delete_expired_tokens).start(1) - - def get_token_info(self, token): - if token in self.token_cache: - return self.token_cache[token] - - rval = rpc.call(context.get_admin_context(), - FLAGS.vncproxy_topic, - {"method": "check_token", "args": {'token': token}}) - if rval: - self.token_cache[token] = rval - return rval + utils.LoopingCall(self.delete_expired_tokens).start(1) @webob.dec.wsgify def __call__(self, req): @@ -78,7 +67,18 @@ class VNCNovaAuthMiddleware(object): return req.get_response(self.app) - def _delete_expired_tokens(self): + def get_token_info(self, token): + if token in self.token_cache: + return self.token_cache[token] + + rval = rpc.call(context.get_admin_context(), + FLAGS.vncproxy_topic, + {"method": "check_token", "args": {'token': token}}) + if rval: + self.token_cache[token] = rval + return rval + + def delete_expired_tokens(self): now = time.time() to_delete = [] for k, v in self.token_cache.items(): |
