Enhance status command (#382)

Print peer status from the package

Added --detail flag for detailed status output
This commit is contained in:
Maycon Santos
2022-07-05 19:47:50 +02:00
committed by GitHub
parent 3bdfa3cc8e
commit 49e9113e0f
10 changed files with 978 additions and 128 deletions

View File

@ -305,15 +305,17 @@ func (e *Engine) removePeer(peerKey string) error {
e.sshServer.RemoveAuthorizedKey(peerKey)
}
conn, exists := e.peerConns[peerKey]
if exists {
defer func() {
err := e.statusRecorder.RemovePeer(peerKey)
if err != nil {
log.Warn("received error when removing peer from status recorder: ", err)
log.Warnf("received error when removing peer %s from status recorder: %v", peerKey, err)
}
}()
conn, exists := e.peerConns[peerKey]
if exists {
delete(e.peerConns, peerKey)
err = conn.Close()
err := conn.Close()
if err != nil {
switch err.(type) {
case *peer.ConnectionAlreadyClosedError: