Provide context in warnings, reduce severity of TLS handshake error (fixes #437)

This commit is contained in:
Jakob Borg 2014-07-30 08:23:48 +02:00
parent ea4524024a
commit 115b967e5b

View File

@ -492,7 +492,7 @@ func setupUPnP(r rand.Source) int {
if len(cfg.Options.ListenAddress) == 1 { if len(cfg.Options.ListenAddress) == 1 {
_, portStr, err := net.SplitHostPort(cfg.Options.ListenAddress[0]) _, portStr, err := net.SplitHostPort(cfg.Options.ListenAddress[0])
if err != nil { if err != nil {
l.Warnln(err) l.Warnln("Bad listen address:", err)
} else { } else {
// Set up incoming port forwarding, if necessary and possible // Set up incoming port forwarding, if necessary and possible
port, _ := strconv.Atoi(portStr) port, _ := strconv.Atoi(portStr)
@ -562,7 +562,7 @@ func restart() {
} }
pgm, err := exec.LookPath(os.Args[0]) pgm, err := exec.LookPath(os.Args[0])
if err != nil { if err != nil {
l.Warnln(err) l.Warnln("Cannot restart:", err)
return return
} }
proc, err := os.StartProcess(pgm, os.Args, &os.ProcAttr{ proc, err := os.StartProcess(pgm, os.Args, &os.ProcAttr{
@ -586,26 +586,26 @@ func saveConfigLoop(cfgFile string) {
for _ = range saveConfigCh { for _ = range saveConfigCh {
fd, err := os.Create(cfgFile + ".tmp") fd, err := os.Create(cfgFile + ".tmp")
if err != nil { if err != nil {
l.Warnln(err) l.Warnln("Saving config:", err)
continue continue
} }
err = config.Save(fd, cfg) err = config.Save(fd, cfg)
if err != nil { if err != nil {
l.Warnln(err) l.Warnln("Saving config:", err)
fd.Close() fd.Close()
continue continue
} }
err = fd.Close() err = fd.Close()
if err != nil { if err != nil {
l.Warnln(err) l.Warnln("Saving config:", err)
continue continue
} }
err = osutil.Rename(cfgFile+".tmp", cfgFile) err = osutil.Rename(cfgFile+".tmp", cfgFile)
if err != nil { if err != nil {
l.Warnln(err) l.Warnln("Saving config:", err)
} }
} }
} }
@ -709,7 +709,7 @@ func listenTLS(conns chan *tls.Conn, addr string, tlsCfg *tls.Config) {
for { for {
conn, err := listener.Accept() conn, err := listener.Accept()
if err != nil { if err != nil {
l.Warnln(err) l.Warnln("Accepting connection:", err)
continue continue
} }
@ -723,7 +723,7 @@ func listenTLS(conns chan *tls.Conn, addr string, tlsCfg *tls.Config) {
tc := tls.Server(conn, tlsCfg) tc := tls.Server(conn, tlsCfg)
err = tc.Handshake() err = tc.Handshake()
if err != nil { if err != nil {
l.Warnln(err) l.Infoln("TLS handshake:", err)
tc.Close() tc.Close()
continue continue
} }
@ -795,7 +795,7 @@ func dialTLS(m *model.Model, conns chan *tls.Conn, tlsCfg *tls.Config) {
tc := tls.Client(conn, tlsCfg) tc := tls.Client(conn, tlsCfg)
err = tc.Handshake() err = tc.Handshake()
if err != nil { if err != nil {
l.Warnln(err) l.Infoln("TLS handshake:", err)
tc.Close() tc.Close()
continue continue
} }