Mercurial > gemma
comparison auth/persistent.go @ 202:dba50c51cda7
Persistent session store: Implemented Session.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 22 Jul 2018 09:38:38 +0200 |
parents | 80dc7bbe97db |
children | 6a802aed7f99 |
comparison
equal
deleted
inserted
replaced
201:80dc7bbe97db | 202:dba50c51cda7 |
---|---|
244 | 244 |
245 return fn(r.con.db) | 245 return fn(r.con.db) |
246 } | 246 } |
247 | 247 |
248 func (pcp *PersistentConnectionPool) Session(token string) *Session { | 248 func (pcp *PersistentConnectionPool) Session(token string) *Session { |
249 log.Println("Session: Not implemented, yet.") | 249 res := make(chan *Session) |
250 return nil | 250 pcp.cmds <- func(pcp *PersistentConnectionPool) { |
251 con := pcp.conns[token] | |
252 if con == nil { | |
253 res <- nil | |
254 } else { | |
255 con.touch() | |
256 pcp.store(token, con) | |
257 res <- con.session | |
258 } | |
259 } | |
260 return <-res | |
251 } | 261 } |
252 | 262 |
253 func (pcp *PersistentConnectionPool) Shutdown() error { | 263 func (pcp *PersistentConnectionPool) Shutdown() error { |
254 log.Println("info: shutdown persistent connection pool.") | 264 log.Println("info: shutdown persistent connection pool.") |
255 if db := pcp.db; db != nil { | 265 if db := pcp.db; db != nil { |