Refine auto-keypair regen functionality. Complain loudly if only one of (cert.pem, key.pem) exists.

This commit is contained in:
Mikkel Krautz 2011-11-10 13:17:18 +01:00
parent 76747e0b71
commit b94b04d2de
4 changed files with 67 additions and 42 deletions

View file

@ -1190,7 +1190,9 @@ func (s *Server) ListenAndMurmur() {
go s.SendUDP()
// Create a new listening TLS socket.
cert, err := tls.LoadX509KeyPair(filepath.Join(Args.DataDir, "cert"), filepath.Join(Args.DataDir, "key"))
certFn := filepath.Join(Args.DataDir, "cert.pem")
keyFn := filepath.Join(Args.DataDir, "key.pem")
cert, err := tls.LoadX509KeyPair(certFn, keyFn)
if err != nil {
s.Printf("Unable to load x509 key pair: %v", err)
return