Skip to content
Snippets Groups Projects
Commit c7a578f7 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

made popKeys return a bool of sucesfull instead of an error

parent e4aa8f1a
No related branches found
No related tags found
No related merge requests found
...@@ -168,7 +168,7 @@ func (s *Store) GetPartner(partnerID *id.ID) (*Manager, error) { ...@@ -168,7 +168,7 @@ func (s *Store) GetPartner(partnerID *id.ID) (*Manager, error) {
} }
//Pops a key for use based upon its fingerprint //Pops a key for use based upon its fingerprint
func (s *Store) PopKey(f format.Fingerprint) (*Key, error) { func (s *Store) PopKey(f format.Fingerprint) (*Key, bool) {
return s.fingerprints.Pop(f) return s.fingerprints.Pop(f)
} }
...@@ -272,14 +272,14 @@ func (f *fingerprints) remove(keys []*Key) { ...@@ -272,14 +272,14 @@ func (f *fingerprints) remove(keys []*Key) {
} }
} }
func (f *fingerprints) Pop(fingerprint format.Fingerprint) (*Key, error) { func (f *fingerprints) Pop(fingerprint format.Fingerprint) (*Key, bool) {
f.mux.Lock() f.mux.Lock()
defer f.mux.Unlock() defer f.mux.Unlock()
key, ok := f.toKey[fingerprint] key, ok := f.toKey[fingerprint]
if !ok { if !ok {
return nil, errors.New("Key could not be found") return nil, false
} }
delete(f.toKey, fingerprint) delete(f.toKey, fingerprint)
...@@ -288,5 +288,5 @@ func (f *fingerprints) Pop(fingerprint format.Fingerprint) (*Key, error) { ...@@ -288,5 +288,5 @@ func (f *fingerprints) Pop(fingerprint format.Fingerprint) (*Key, error) {
key.fp = &fingerprint key.fp = &fingerprint
return key, nil return key, true
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment