1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-06-16 04:44:55 +02:00

internal/server/server.go: need to provide a callback to AsyncWrite to close the connection.

This commit is contained in:
Henrik Hautakoski 2023-02-06 12:45:50 +01:00
parent 5ed22bfdc6
commit 83fd4826d7
No known key found for this signature in database
GPG key ID: 217490840C18A5D9

View file

@ -109,7 +109,10 @@ func (s *Server) OnTraffic(c gnet.Conn) gnet.Action {
logger.Info("API Check", params.Combine(healthCheckApi.LogInfo())...)
// Report status to HAproxy
err = c.AsyncWrite([]byte(status.String()), nil)
err = c.AsyncWrite([]byte(status.String()), func(c gnet.Conn, err error) error {
return c.Close()
})
if err != nil {
logger.Error("Write", "message", err)
}