Sfoglia il codice sorgente

* Enter burst mode for 20 seconds

Bryan Drewery 16 anni fa
parent
commit
d7be009a16
2 ha cambiato i file con 42 aggiunte e 7 eliminazioni
  1. 10 0
      src/mod/server.mod/server.c
  2. 32 7
      src/mod/server.mod/servmsg.c

+ 10 - 0
src/mod/server.mod/server.c

@@ -92,6 +92,9 @@ static time_t lastpingtime;	/* IRCNet LAGmeter support -- drummer */
 static char stackablecmds[511] = "";
 static char stackablecmds[511] = "";
 static char stackable2cmds[511] = "";
 static char stackable2cmds[511] = "";
 static egg_timeval_t last_time;
 static egg_timeval_t last_time;
+static time_t connect_bursting = 0;
+static int real_msgburst = 0;
+static int real_msgrate = 0;
 static bool use_penalties;
 static bool use_penalties;
 static int use_fastdeq;
 static int use_fastdeq;
 size_t nick_len = 9;			/* Maximal nick length allowed on the network. */
 size_t nick_len = 9;			/* Maximal nick length allowed on the network. */
@@ -985,6 +988,13 @@ static void server_secondly()
     --cycle_time;
     --cycle_time;
   if (!resolvserv && serv < 0 && !trying_server)
   if (!resolvserv && serv < 0 && !trying_server)
     connect_server();
     connect_server();
+
+  if (connect_bursting && server_online && (now - 20) >= connect_bursting) {
+    connect_bursting = 0;
+    msgburst = real_msgburst;
+    msgrate = real_msgrate;
+    putlog(LOG_DEBUG, "*", "Ending server burst mode");
+  }
 }
 }
 
 
 static void server_check_lag()
 static void server_check_lag()

+ 32 - 7
src/mod/server.mod/servmsg.c

@@ -258,18 +258,40 @@ got004(char *from, char *msg)
   } else if (strstr(tmp, "hybrid") || strstr(tmp, "ratbox"))
   } else if (strstr(tmp, "hybrid") || strstr(tmp, "ratbox"))
     connect_burst = 1;
     connect_burst = 1;
 
 
-  if (replaying_cache || !connect_burst)
-    join_chans();
-  else {
+  if (!replaying_cache && connect_burst) {
     // Hybrid/ratbox allows bursting 5*8 lines on connect until certain commands are sent, for up to 30 seconds
     // Hybrid/ratbox allows bursting 5*8 lines on connect until certain commands are sent, for up to 30 seconds
-    int oldburst = msgburst;
+    /*
+       BAD:
+         JOIN 0
+         MODE #chan b
+         NICK
+         PART
+         KICK
+         CPRIVMSG
+         CNOTICE
+         WHO 0/mask
+         TIME
+         TOPIC
+         INVITE
+         AWAY
+         OPER
+
+       OK:
+         WHO *
+         WHO !
+         WHO #Chan
+         WHO NICK
+    */
+
+    connect_bursting = now;
     msgburst = 5 * 8;
     msgburst = 5 * 8;
-    join_chans();
+    msgrate = 200;
     last_time.sec = now - 100;
     last_time.sec = now - 100;
-    deq_msg();
-    msgburst = oldburst;
+    putlog(LOG_DEBUG, "*", "Server allows connect bursting, bursting for 20 seconds");
   }
   }
 
 
+  join_chans();
+
   return 0;
   return 0;
 }
 }
 
 
@@ -1792,6 +1814,9 @@ static void server_dns_callback(int id, void *client_data, const char *host, bd:
     // Just connecting, set last queue time to the past.
     // Just connecting, set last queue time to the past.
     last_time.sec = now - 100;
     last_time.sec = now - 100;
     last_time.usec = 0;
     last_time.usec = 0;
+    connect_bursting = 0;
+    real_msgburst = msgburst;
+    real_msgrate = msgrate;
 
 
     if (serverpass[0])
     if (serverpass[0])
       dprintf(DP_MODE, "PASS %s\n", serverpass);
       dprintf(DP_MODE, "PASS %s\n", serverpass);