+ }
+
+ if((maxconnections - 10) < rb_get_fd(F)) /* XXX this is kinda bogus */
+ {
+ ++ServerStats.is_ref;
+ /*
+ * slow down the whining to opers bit
+ */
+ if((last_oper_notice + 20) <= rb_current_time())
+ {
+ sendto_realops_flags(SNO_GENERAL, L_ALL,
+ "All connections in use. (%s)",
+ get_listener_name(listener));
+ last_oper_notice = rb_current_time();
+ }
+
+ rb_write(F, "ERROR :All connections in use\r\n", 32);
+ rb_close(F);
+ /* Re-register a new IO request for the next accept .. */
+ return 0;
+ }
+
+ aconf = find_dline(addr, AF_INET);
+ if(aconf != NULL && (aconf->status & CONF_EXEMPTDLINE))
+ return 1;
+
+ /* Do an initial check we aren't connecting too fast or with too many
+ * from this IP... */
+ if(aconf != NULL)
+ {
+ ServerStats.is_ref++;
+
+ if(ConfigFileEntry.dline_with_reason)
+ {
+ if (rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", aconf->passwd) >= (int)(sizeof(buf)-1))
+ {
+ buf[sizeof(buf) - 3] = '\r';
+ buf[sizeof(buf) - 2] = '\n';
+ buf[sizeof(buf) - 1] = '\0';
+ }
+ }
+ else
+ strcpy(buf, "ERROR :You have been D-lined.\r\n");
+
+ rb_write(F, buf, strlen(buf));
+ rb_close(F);
+ return 0;
+ }
+
+ return 1;
+}
+