The concept
The idea is to have a main process that takes input from IRC, toss that to one
a small number of "worker threads", which then take their time processing whatever
needs to be, and tosses the result back to IRC for display. Using multiple threads
lets the bot do quick things while a longer task (like an LWP fetch) is taking
place.
Components
| Main IRC select() loop |
- Start or restart IRC Connection objects and Worker threads
- IRC input pushes to Worker queues, in a round-robin way
- IRC output to channel (sent from IRC::ircOut - thread managing output queue)
- Input from external named pipe, for SMS paging input, etc.
|
| Worker Thread (multiple are running) |
- Polls input from IRC via this worker's input queue
- Calls Handler objects run() method, if output is returned,
it tosses that to the IRC output queue, and stops.
- If no output from Handlers, calls InfoBot::run(), outputs any result
to IRC output queue
|
| IRC::ircOut thread |
- Polls IRC output queue, when data is recieved, handles it, usually
calling Net::IRC operations, which will then be processed by
the main IRC loop
|