]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/packet.c
dlink -> rb_dlink
[irc/rqf/shadowircd.git] / src / packet.c
index 7c8c87fd91428d11a18d0d01bb056eb14468c668..98bace1b0c03190d2755251a5f1fca2abecaf98a 100644 (file)
@@ -21,7 +21,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: packet.c 262 2005-09-22 00:38:45Z jilles $
+ *  $Id: packet.c 3446 2007-05-14 22:21:16Z jilles $
  */
 #include "stdinc.h"
 #include "tools.h"
@@ -56,12 +56,9 @@ parse_client_queued(struct Client *client_p)
 
        if(IsUnknown(client_p))
        {
-               int i = 0;
-
                for (;;)
                {
-                       /* rate unknown clients at MAX_FLOOD per loop */
-                       if(i >= MAX_FLOOD)
+                       if(client_p->localClient->sent_parsed >= client_p->localClient->allow_read)
                                break;
 
                        dolen = linebuf_get(&client_p->localClient->
@@ -72,7 +69,7 @@ parse_client_queued(struct Client *client_p)
                                break;
 
                        client_dopacket(client_p, readBuf, dolen);
-                       i++;
+                       client_p->localClient->sent_parsed++;
 
                        /* He's dead cap'n */
                        if(IsAnyDead(client_p))
@@ -81,7 +78,13 @@ parse_client_queued(struct Client *client_p)
                         * to the parsing for their appropriate status.  --fl
                         */
                        if(!IsUnknown(client_p))
+                       {
+                               /* reset their flood limits, they're now
+                                * graced to flood
+                                */
+                               client_p->localClient->sent_parsed = 0;
                                break;
+                       }
 
                }
        }
@@ -201,7 +204,7 @@ flood_recalc(int fd, void *data)
                return;
 
        /* and finally, reset the flood check */
-       comm_setflush(fd, 1000, flood_recalc, client_p);
+       rb_setflush(fd, 1000, flood_recalc, client_p);
 }
 
 /*
@@ -327,7 +330,7 @@ read_ctrl_packet(int fd, void *data)
 
       nodata:
        /* If we get here, we need to register for another COMM_SELECT_READ */
-       comm_setselect(fd, FDLIST_SERVER, COMM_SELECT_READ, read_ctrl_packet, server, 0);
+       rb_setselect(fd, FDLIST_SERVER, COMM_SELECT_READ, read_ctrl_packet, server, 0);
 }
 
 /*
@@ -353,13 +356,13 @@ read_packet(int fd, void *data)
         * I personally think it makes the code too hairy to make sane.
         *     -- adrian
         */
-       length = read(client_p->localClient->fd, readBuf, READBUF_SIZE);
+       length = client_p->localClient->F->read_impl(client_p->localClient->F, readBuf, READBUF_SIZE);
 
        if(length <= 0)
        {
                if((length == -1) && ignoreErrno(errno))
                {
-                       comm_setselect(client_p->localClient->fd, FDLIST_IDLECLIENT,
+                       rb_setselect(client_p->localClient->F->fd, FDLIST_IDLECLIENT,
                                       COMM_SELECT_READ, read_packet, client_p, 0);
                        return;
                }
@@ -413,12 +416,12 @@ read_packet(int fd, void *data)
        /* If we get here, we need to register for another COMM_SELECT_READ */
        if(PARSE_AS_SERVER(client_p))
        {
-               comm_setselect(client_p->localClient->fd, FDLIST_SERVER, COMM_SELECT_READ,
+               rb_setselect(client_p->localClient->F->fd, FDLIST_SERVER, COMM_SELECT_READ,
                              read_packet, client_p, 0);
        }
        else
        {
-               comm_setselect(client_p->localClient->fd, FDLIST_IDLECLIENT,
+               rb_setselect(client_p->localClient->F->fd, FDLIST_IDLECLIENT,
                               COMM_SELECT_READ, read_packet, client_p, 0);
        }
 }