<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.shoutirc.com/index.php?action=history&amp;feed=atom&amp;title=Buffered_Send</id>
	<title>Buffered Send - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.shoutirc.com/index.php?action=history&amp;feed=atom&amp;title=Buffered_Send"/>
	<link rel="alternate" type="text/html" href="https://wiki.shoutirc.com/index.php?title=Buffered_Send&amp;action=history"/>
	<updated>2026-04-28T21:23:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.shoutirc.com/index.php?title=Buffered_Send&amp;diff=4350&amp;oldid=prev</id>
		<title>Indy at 13:53, 25 October 2013</title>
		<link rel="alternate" type="text/html" href="https://wiki.shoutirc.com/index.php?title=Buffered_Send&amp;diff=4350&amp;oldid=prev"/>
		<updated>2013-10-25T13:53:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The [[Buffered Send]] aka SendQ system was a new feature in IRCBot v3. It assures that any asynchronous I/O does not cause problems on your IRC servers and also ensures the bot does not send so much data as to flood itself off the network.&lt;br /&gt;
&lt;br /&gt;
The SendQ in IRCBot v3 had 2 levels: low priority spam/bulk data and high priority interactive data, this worked pretty well.&lt;br /&gt;
&lt;br /&gt;
It was completely revamped and rewritten for IRCBot v4.&lt;br /&gt;
&lt;br /&gt;
There are now up to 256 priority levels (although I can&amp;#039;t imagine using that many). By default, RadioBot uses:&lt;br /&gt;
&lt;br /&gt;
 PRIORITY_LOWEST              0&lt;br /&gt;
 Lowest priority bulk data (mostly LogChan stuff)&lt;br /&gt;
&lt;br /&gt;
 PRIORITY_SPAM                1&lt;br /&gt;
 Slightly higher priority for channel spamming/song updates/etc.&lt;br /&gt;
&lt;br /&gt;
 PRIORITY_DEFAULT             10&lt;br /&gt;
 The default priority for data that isn&amp;#039;t specified as another level.&lt;br /&gt;
&lt;br /&gt;
 PRIORITY_INTERACTIVE         60&lt;br /&gt;
 The Interactive priority is for responses from !triggers and other cases where a minimal amount of delay is wanted&lt;br /&gt;
&lt;br /&gt;
 PRIORITY_IMMEDIATE           99&lt;br /&gt;
 The Immediate priority is for data where minimal delay is important. This level is limited to things like server logins/channel operations/ping replies/etc.&lt;br /&gt;
&lt;br /&gt;
WARNING: Technical Data follows!!!&lt;br /&gt;
&lt;br /&gt;
==Diagram==&lt;br /&gt;
This diagram shows an overview of the SendQ priority system.&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:new_v4_sendq.png]]&lt;br /&gt;
&lt;br /&gt;
Data is sent in descending priority (ie. 99 will be sent first, 0 last), all of the data blocks from the highest level will be sent before moving on to lower levels.&lt;br /&gt;
&lt;br /&gt;
==Algorithm Implementation==&lt;br /&gt;
This system could easily be implemented in C structures (linked lists, dynamically allocated arrays, etc.) or in C++ using STL map (for the priority levels) and vectors/queues for the FIFOs.&lt;br /&gt;
&lt;br /&gt;
==Algorithm Limitations==&lt;br /&gt;
Just a note for anyone who wants to implement a similar system. This SendQ was designed for rate-limited IRC connections where there will be lots of times when higher levels will be empty for lower levels to get their data sent. If you use a system where higher priority classes are almost always full you could choke-out the lower levels and the data may never be sent, in order to remedy that you would need to modify the system to not send all data in the highest class before moving on to the next level. This could easily be done by basing the number of data chunks to send on the priority. (ie if there was a Priority of 5 it would send 5 data chunks before moving to the next lower level and looping around back to the highest level when it reaches the bottom)&lt;br /&gt;
&lt;br /&gt;
{{radiobot_programming}}&lt;/div&gt;</summary>
		<author><name>Indy</name></author>
	</entry>
</feed>