瀏覽代碼

Update vendored bolt

Rod Hynes 6 年之前
父節點
當前提交
91a29ec447
共有 2 個文件被更改,包括 23 次插入6 次删除
  1. 20 3
      vendor/github.com/Psiphon-Labs/bolt/tx.go
  2. 3 3
      vendor/vendor.json

+ 20 - 3
vendor/github.com/Psiphon-Labs/bolt/tx.go

@@ -391,9 +391,26 @@ func (tx *Tx) Check() <-chan error {
 // SynchronousCheck performs the Check function in the current goroutine,
 // allowing the caller to recover from any panics or faults.
 func (tx *Tx) SynchronousCheck() error {
-	ch := make(chan error)
-	tx.check(ch)
-	return <-ch
+	checkErrChannel := make(chan error)
+
+	// tx.check may send multiple errors to the channel, and we must consume them
+	// all to ensure tx.check terminates. Only the first error is returned from
+	// SynchronousCheck.
+	firstErrChannel := make(chan error)
+	go func() {
+		var err error
+		for nextErr := range checkErrChannel {
+			if err != nil {
+				err = nextErr
+			}
+		}
+		firstErrChannel <- err
+	}()
+
+	// Invoke bolt code that may panic/segfault in the current goroutine.
+	tx.check(checkErrChannel)
+
+	return <-firstErrChannel
 }
 
 func (tx *Tx) check(ch chan error) {

+ 3 - 3
vendor/vendor.json

@@ -33,10 +33,10 @@
 			"revisionTime": "2017-02-28T16:03:01Z"
 		},
 		{
-			"checksumSHA1": "dVfefYjTFuN1AKIJyCcqNrlLEJo=",
+			"checksumSHA1": "67iDmaqZg4yqCUDeSlS8uaavYaw=",
 			"path": "github.com/Psiphon-Labs/bolt",
-			"revision": "b7c055003ce9d8a1bddb9416648cb7d955a3148d",
-			"revisionTime": "2019-07-19T17:53:53Z"
+			"revision": "e81ac70c2ed7bcd43e90d848343c42830df1d999",
+			"revisionTime": "2019-07-28T19:25:17Z"
 		},
 		{
 			"checksumSHA1": "d3DwsdacdFn1/KCG/2uPV1PwR3s=",