From 1656a82398e7c00e2ac862236a5d56e5507fbd46 Mon Sep 17 00:00:00 2001
From: Jake Taylor <jake@elixxir.io>
Date: Tue, 6 Sep 2022 17:07:59 -0500
Subject: [PATCH] revert some stuff

---
 auth/store/store.go | 12 +++++++++++-
 go.mod              |  2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/auth/store/store.go b/auth/store/store.go
index e2238d7c2..5a42a0aa9 100644
--- a/auth/store/store.go
+++ b/auth/store/store.go
@@ -242,8 +242,9 @@ func (s *Store) HandleReceivedRequest(partner *id.ID, handler func(*ReceivedRequ
 
 	s.mux.RLock()
 	rr, ok := s.receivedByID[*partner]
+	s.mux.RUnlock()
+
 	if !ok {
-		s.mux.RUnlock()
 		return errors.Errorf("Received request not "+
 			"found: %s", partner)
 	}
@@ -252,8 +253,17 @@ func (s *Store) HandleReceivedRequest(partner *id.ID, handler func(*ReceivedRequ
 	rr.mux.Lock()
 	defer rr.mux.Unlock()
 
+	// Check that the request still exists; it could have been deleted while the
+	// lock was taken
+	s.mux.RLock()
+	_, ok = s.receivedByID[*partner]
 	s.mux.RUnlock()
 
+	if !ok {
+		return errors.Errorf("Received request not "+
+			"found: %s", partner)
+	}
+
 	//run the handler
 	handleErr := handler(rr)
 	if handleErr != nil {
diff --git a/go.mod b/go.mod
index fa815c2b5..708f9615e 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,6 @@ require (
 	github.com/cloudflare/circl v1.2.0
 	github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
 	github.com/golang/protobuf v1.5.2
-	github.com/hack-pad/go-indexeddb v0.2.0
 	github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
 	github.com/pkg/errors v0.9.1
 	github.com/pkg/profile v1.6.0
@@ -33,6 +32,7 @@ require (
 	github.com/badoux/checkmail v1.2.1 // indirect
 	github.com/elliotchance/orderedmap v1.4.0 // indirect
 	github.com/fsnotify/fsnotify v1.5.4 // indirect
+	github.com/hack-pad/go-indexeddb v0.2.0 // indirect
 	github.com/hashicorp/hcl v1.0.0 // indirect
 	github.com/inconshreveable/mousetrap v1.0.0 // indirect
 	github.com/klauspost/cpuid/v2 v2.1.0 // indirect
-- 
GitLab