fix: check TCPAddr and log error on closing connection, then abort

This commit is contained in:
Derrick Hammer 2024-03-10 07:38:44 -04:00
parent 1f8d383da7
commit 71cb44dc61
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 11 additions and 1 deletions

View File

@ -91,8 +91,18 @@ func (h *HTTPServiceDefault) p2pHandler(ctx jape.Context) {
if v.IP.IsLoopback() {
err := peer.End()
if err != nil {
return
h.Logger().Error("error ending peer", zap.Error(err))
}
return
}
case *net.TCPAddr:
if v.IP.IsLoopback() {
err := peer.End()
if err != nil {
h.Logger().Error("error ending peer", zap.Error(err))
}
return
}
}