3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

server: Fix comments

This commit is contained in:
Daniel Oaks 2017-09-11 16:41:59 +10:00
parent 989fea18f9
commit 8cd016e4c0

View File

@ -432,13 +432,14 @@ func (server *Server) Run() {
}() }()
case conn := <-server.newConns: case conn := <-server.newConns:
// check connection limits // check IP address
ipaddr := net.ParseIP(IPString(conn.Conn.RemoteAddr())) ipaddr := net.ParseIP(IPString(conn.Conn.RemoteAddr()))
if ipaddr == nil { if ipaddr == nil {
conn.Conn.Write([]byte(couldNotParseIPMsg)) conn.Conn.Write([]byte(couldNotParseIPMsg))
conn.Conn.Close() conn.Conn.Close()
continue continue
} }
// check DLINEs // check DLINEs
isBanned, info := server.dlines.CheckIP(ipaddr) isBanned, info := server.dlines.CheckIP(ipaddr)
if isBanned { if isBanned {
@ -475,7 +476,8 @@ func (server *Server) Run() {
} }
server.dlines.AddIP(ipaddr, length, server.connectionThrottle.BanMessage, "Exceeded automated connection throttle") server.dlines.AddIP(ipaddr, length, server.connectionThrottle.BanMessage, "Exceeded automated connection throttle")
// reset ban on connectionThrottle // they're DLINE'd for 15 minutes or whatever, so we can reset the connection throttle now,
// and once their temporary DLINE is finished they can fill up the throttler again
server.connectionThrottle.ResetFor(ipaddr) server.connectionThrottle.ResetFor(ipaddr)
// this might not show up properly on some clients, but our objective here is just to close it out before it has a load impact on us // this might not show up properly on some clients, but our objective here is just to close it out before it has a load impact on us