// Call in proton goroutine to close an endpoint locally // handler will complete the close when remote end closes. func localClose(ep proton.Endpoint, err error) { if ep.State().LocalActive() { if err != nil { ep.Condition().SetError(err) } ep.Close() } }