Mercurial > gemma
changeset 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 |
files | auth/persistent.go |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/auth/persistent.go Sun Jul 22 09:34:45 2018 +0200 +++ b/auth/persistent.go Sun Jul 22 09:38:38 2018 +0200 @@ -246,8 +246,18 @@ } func (pcp *PersistentConnectionPool) Session(token string) *Session { - log.Println("Session: Not implemented, yet.") - return nil + res := make(chan *Session) + pcp.cmds <- func(pcp *PersistentConnectionPool) { + con := pcp.conns[token] + if con == nil { + res <- nil + } else { + con.touch() + pcp.store(token, con) + res <- con.session + } + } + return <-res } func (pcp *PersistentConnectionPool) Shutdown() error {