X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=blobdiff_plain;f=ircd%2FIPcheck.c;h=67b34851cb8fe0bbe4ce905040c4ff1179e81c83;hp=373958e9dc030eb7b6e0af3f9f99596c4c398ac4;hb=894ccd3b8d5acb0067562d26bf72228d3e617203;hpb=2cf13869e6194d21a1f245aa251b33cb03b77bb6 diff --git a/ircd/IPcheck.c b/ircd/IPcheck.c index 373958e..67b3485 100644 --- a/ircd/IPcheck.c +++ b/ircd/IPcheck.c @@ -373,13 +373,20 @@ int ip_registry_check_remote(struct Client* cptr, int is_burst) * of their own. This "undoes" the effect of ip_registry_check_local() * so the client's address is not penalized for the failure. * @param[in] addr Address of rejected client. + * @param[in] disconnect If true, also count the client as disconnecting. */ -void ip_registry_connect_fail(const struct irc_in_addr *addr) +void ip_registry_connect_fail(const struct irc_in_addr *addr, int disconnect) { struct IPRegistryEntry* entry = ip_registry_find(addr); - if (entry && 0 == --entry->attempts) { - Debug((DEBUG_DNS, "IPcheck noting local connection failure for %s.", ircd_ntoa(&entry->addr))); - ++entry->attempts; + if (entry) { + if (0 == --entry->attempts) { + Debug((DEBUG_DNS, "IPcheck noting local connection failure for %s.", ircd_ntoa(&entry->addr))); + ++entry->attempts; + } + if (disconnect) { + assert(entry->connected > 0); + entry->connected--; + } } } @@ -521,11 +528,12 @@ int IPcheck_remote_connect(struct Client *cptr, int is_burst) * of their own. This "undoes" the effect of ip_registry_check_local() * so the client's address is not penalized for the failure. * @param[in] cptr Client who has been rejected. + * @param[in] disconnect If true, also count the client as disconnecting. */ -void IPcheck_connect_fail(const struct Client *cptr) +void IPcheck_connect_fail(const struct Client *cptr, int disconnect) { assert(IsIPChecked(cptr)); - ip_registry_connect_fail(&cli_ip(cptr)); + ip_registry_connect_fail(&cli_ip(cptr), disconnect); } /** Handle a client that has successfully connected.