Print success to socket if no error was thrown

When Reto Brunners patch is applied (which works really well for me), the user gets to see the message
returned by AercServer. Since this is nil if no errors were thrown it
prints "result: <nil>" to the cmd. This patch fixes that by just
returning success instead of the error message when err != nil.
This commit is contained in:
Heiko Carrasco 2019-09-29 13:22:36 +02:00 committed by Drew DeVault
parent 1bedb8fe06
commit 70c16fc346

View file

@ -76,7 +76,11 @@ func (as *AercServer) handleClient(conn net.Conn) {
if as.OnMailto != nil { if as.OnMailto != nil {
err = as.OnMailto(mailto) err = as.OnMailto(mailto)
} }
if err != nil {
conn.Write([]byte(fmt.Sprintf("result: %v\n", err))) conn.Write([]byte(fmt.Sprintf("result: %v\n", err)))
} else {
conn.Write([]byte(fmt.Sprint("result: success\n")))
}
} }
} }
as.logger.Printf("Closed Unix connection %d", clientId) as.logger.Printf("Closed Unix connection %d", clientId)