]> Cypherpunks.ru repositories - gocheese.git/blobdiff - main.go
Too early defer
[gocheese.git] / main.go
diff --git a/main.go b/main.go
index cc5944ed9529319bba7c41d9173d11dd97a868e8..c14906fb7c87ac04b9308b426850c2efb59346b3 100644 (file)
--- a/main.go
+++ b/main.go
@@ -236,7 +236,7 @@ func main() {
                tlsConfig.VerifyConnection = func(s tls.ConnectionState) error {
                        spki := s.VerifiedChains[0][0].RawSubjectPublicKeyInfo
                        theirDgst := sha256.Sum256(spki)
-                       if bytes.Compare(ourDgst, theirDgst[:]) != 0 {
+                       if !bytes.Equal(ourDgst, theirDgst[:]) {
                                return errors.New("certificate's SPKI digest mismatch")
                        }
                        return nil
@@ -274,8 +274,8 @@ func main() {
        }
        ln = netutil.LimitListener(ln, *MaxClients)
 
-       needsShutdown := make(chan os.Signal, 0)
-       exitErr := make(chan error, 0)
+       needsShutdown := make(chan os.Signal, 1)
+       exitErr := make(chan error)
        signal.Notify(needsShutdown, syscall.SIGTERM, syscall.SIGINT)
        go func(s *http.Server) {
                <-needsShutdown