Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Throw off huffman encoding by using "infrequent" characters
- // see http://www.dspguide.com/ch27/3.htm
- function hmGenTable()
- {
- %infq = "!\"#$%&'()*+-?/:;<>=@~|{}^[]\\_`";
- $hm::infq_t = strlen(%infq);
- for(%i = 0; %i < $hm::infq_t; %i++)
- $hm::infq_t[%i] = getSubStr(%infq, %i, 1);
- }
- function hmStr(%len)
- {
- if($hm::infq_t $= "")
- hmGenTable();
- for(%i = 0; %i < %len; %i++)
- %rand = %rand @ $hm::infq_t[getRandom($hm::infq_t - 1)];
- return %rand;
- }
- function spamPacketsToAll()
- {
- cancel($spamPackets);
- // Packet size is 1023; we want to be some amount under that.
- // Spam a bunch of remote command events to fill up the buffer.
- // Ghosting also fills it so optimally this will run on an empty server.
- // Note: net string length limited to 256
- // Note: not counting packet headers
- while(%bits < (900 << 3))
- {
- // event: tag (~4 bytes) + 5 bits argc + strings
- // writeString: bit (encode flag) + byte (length) + string bytes (no null)
- // Simulate a bunch of random sized events being sent (a busy server)
- %len = getRandom(64, 128);
- %bits += (46 + (%len << 3));
- commandtoall('spam', hmStr(%len));
- }
- // Run each tick
- $spamPackets = schedule(32, 0, spamPacketsToAll);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement