VOL-2850 Fixed an issue where the RequestQueue could get stuck on context cancelation.

(I had the incorrect assumption that a multi-value channel read would always return immediately, but this is not the case.)

Change-Id: Ib06b3da8463331e9566b28c95aff9177447ad3b1
diff --git a/rw_core/utils/core_utils.go b/rw_core/utils/core_utils.go
index 185a8e8..aacb8ae 100644
--- a/rw_core/utils/core_utils.go
+++ b/rw_core/utils/core_utils.go
@@ -90,7 +90,13 @@
 		rq.mutex.Lock()
 		defer rq.mutex.Unlock()
 
-		if _, notified := <-waitingOn; !notified {
+		select {
+		case <-waitingOn:
+			// chan has been closed, so the lock has been acquired
+			// context is canceled, so just release the lock immediately
+			rq.current = r
+			rq.releaseWithoutLock()
+		default:
 			// on abort, skip our position in the queue
 			r.prev.notifyOnComplete = r.notifyOnComplete
 			// and remove ourselves from the queue
@@ -101,11 +107,6 @@
 				rq.last = r.prev
 				r.prev.next = nil
 			}
-
-		} else {
-			// context is canceled, but lock has been acquired, so just release the lock immediately
-			rq.current = r
-			rq.releaseWithoutLock()
 		}
 		return ctx.Err()