vendor: Mega update all dependencies
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4080
This commit is contained in:
17
vendor/github.com/oschwald/maxminddb-golang/reader_other.go
generated
vendored
17
vendor/github.com/oschwald/maxminddb-golang/reader_other.go
generated
vendored
@@ -2,7 +2,10 @@
|
||||
|
||||
package maxminddb
|
||||
|
||||
import "os"
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// Open takes a string path to a MaxMind DB file and returns a Reader
|
||||
// structure or an error. The database file is opened using a memory map,
|
||||
@@ -41,16 +44,18 @@ func Open(file string) (*Reader, error) {
|
||||
}
|
||||
|
||||
reader.hasMappedFile = true
|
||||
runtime.SetFinalizer(reader, (*Reader).Close)
|
||||
return reader, err
|
||||
}
|
||||
|
||||
// Close unmaps the database file from virtual memory and returns the
|
||||
// resources to the system. If called on a Reader opened using FromBytes
|
||||
// or Open on Google App Engine, this method does nothing.
|
||||
func (r *Reader) Close() (err error) {
|
||||
if r.hasMappedFile {
|
||||
err = munmap(r.buffer)
|
||||
r.hasMappedFile = false
|
||||
func (r *Reader) Close() error {
|
||||
if !r.hasMappedFile {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
runtime.SetFinalizer(r, nil)
|
||||
r.hasMappedFile = false
|
||||
return munmap(r.buffer)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user