network module¶
Sputnik Network Implementation
This module provides the Sputnik Network implementation. This is a subclass of a Connection, and defines an interface to IRC server networks implementing _RFC 2813: https://tools.ietf.org/html/rfc2813 .
-
class
network.
Network
(bouncer, network, hostname, port, nickname, username, realname, password=None, usermode=0)[source]¶ Bases:
connection.Connection
An instance of a connection to an IRC network.
A Network is the product of an asyncio protocol factory, and represents an instance of a connection from an IRC client to an IRC server. This could be either a single IRC server, or more likely, a network of servers behind a load balancer. It does not implement an actual IRC server, as defined in
-
??? (revisit this later)
-
attempt_reconnect
(attempt=0, retries=5)[source]¶ Attempts to reconnect to a network that unexpectedly disconnected.
This is only called if we drop the connection to a network and the connected flag is set, to distinguish from intentional disconnects.
Parameters:
-
connection_lost
(exc)[source]¶ Unregisters the connected Network from the Bouncer.
Removes the Network from the dictionary of connected Clients in the Bouncer before the connection is terminated. After this point, there should be no remaining references to this instance of the Network.
-
connection_made
(transport)[source]¶ Registers the connected Network with the Bouncer.
Adds the Network to the set of connected Networks in the Bouncer and saves the transport for later use. This also creates a collection of buffers and logging facilities, and initiates the authentication handshake, if applicable.
-
data_received
(data)[source]¶ Handles incoming messages from connected IRC networks.
Messages coming from IRC networks are potentially batched and need to be parsed into individual lines before any other operation may occur. On certain occasions, incoming data may overflow the transport buffer, requiring additional logic to reconstitute the messages into a single stream. Afterwards, we split lines according to the IRC message format and perform actions as appropriate.
-