(sessionKey string, cs *tls.ClientSessionState)
| 196 | } |
| 197 | |
| 198 | func (cache *PersistentClientSessionCache) put(sessionKey string, cs *tls.ClientSessionState) { |
| 199 | csBytes, err := clientSessionStateToBytes(cs) |
| 200 | if err != nil { |
| 201 | cache.logger.Error("dropping client session state with key %q: unable to marshal client session state: %v", sessionKey, err) |
| 202 | return |
| 203 | } |
| 204 | err = cache.db.Update(func(tx *bbolt.Tx) error { |
| 205 | if bucket, err := tx.CreateBucketIfNotExists(bucketName); err == nil { |
| 206 | return bucket.Put([]byte(sessionKey), csBytes) |
| 207 | } else { |
| 208 | return err |
| 209 | } |
| 210 | }) |
| 211 | if err != nil { |
| 212 | cache.logger.Error("cache db: key %q write failed: %v", sessionKey, err) |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | func (cache *PersistentClientSessionCache) Put(sessionKey string, cs *tls.ClientSessionState) { |
| 217 | if cs == nil { |
no test coverage detected