fix: set forwarded ip before checking for a blocked connection

This commit is contained in:
Derrick Hammer 2024-03-11 16:08:47 -04:00
parent 3cce024829
commit d2b2fa09e3
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 4 deletions

View File

@ -115,6 +115,10 @@ func (h *HTTPServiceDefault) p2pHandler(ctx jape.Context) {
}
}
if clientIP != nil {
peer.SetIP(&net.IPAddr{IP: clientIP})
}
if blockConnection(peer.GetIP()) {
err := peer.End()
if err != nil {
@ -123,10 +127,6 @@ func (h *HTTPServiceDefault) p2pHandler(ctx jape.Context) {
return
}
if clientIP != nil {
peer.SetIP(&net.IPAddr{IP: clientIP})
}
h.Services().P2P().ConnectionTracker().Add(1)
go func() {