Change status _after_ calling StoreEntry::get_entry()

StoreEntry::get_entry() will return an error if the store entry's status
is "borrowed".
This commit is contained in:
Julian Ganz 2016-01-28 20:43:04 +01:00
parent 6c53f172dc
commit c6ec47a8af

View file

@ -147,8 +147,9 @@ impl Store {
.map_err(|_| StoreError::new(StoreErrorKind::LockPoisoned, None))
.and_then(|mut es| {
let mut se = es.entry(id.clone()).or_insert_with(|| StoreEntry::new(id.clone()));
let entry = se.get_entry();
se.status = StoreEntryStatus::Borrowed;
se.get_entry()
entry
})
.map(|e| FileLockEntry::new(self, e, id))
}