aboutsummaryrefslogtreecommitdiff
path: root/cert.go
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2020-12-17 17:15:24 -0500
committerAdnan Maolood <[email protected]>2020-12-17 17:15:24 -0500
commita1dd8de337bcdbc4fa690a8af8ea8e4ac37508d9 (patch)
tree8d8c8b29588d9733d615de12e0dff091cedd848c /cert.go
parentUse RWMutex instead of Mutex (diff)
downloadgo-gemini-a1dd8de337bcdbc4fa690a8af8ea8e4ac37508d9.tar.xz
go-gemini-a1dd8de337bcdbc4fa690a8af8ea8e4ac37508d9.zip
Fix locking up of KnownHostsFile and CertificateDir
Diffstat (limited to 'cert.go')
-rw-r--r--cert.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/cert.go b/cert.go
index dd8a1f5..0c897dd 100644
--- a/cert.go
+++ b/cert.go
@@ -82,8 +82,6 @@ func (c *CertificateDir) Lookup(scope string) (tls.Certificate, bool) {
// localhost.crt (certificate) and localhost.key (private key).
// New certificates will be written to this directory.
func (c *CertificateDir) Load(path string) error {
- c.mu.Lock()
- defer c.mu.Unlock()
matches, err := filepath.Glob(filepath.Join(path, "*.crt"))
if err != nil {
return err
@@ -99,8 +97,7 @@ func (c *CertificateDir) Load(path string) error {
scope = strings.ReplaceAll(scope, ":", "/")
c.Add(scope, cert)
}
- c.dir = true
- c.path = path
+ c.SetDir(path)
return nil
}