jaraco / irc

Full-featured Python IRC library for Python.
MIT License
392 stars 87 forks source link

Asyncio #144

Closed MattBroach closed 6 years ago

MattBroach commented 6 years ago

In this PR:

Not in this PR:

Note: In case you use git/github diffs for code review -- the code in the original irc.client.py had almost no actual changes, but it was reordered due to a referencing issue. The only actual change was on the Reactor class, in which I added the connection_class = ServerConnection field to the class, and changed the server() function from:

    def server(self):
        """Creates and returns a ServerConnection object."""

        c = ServerConnection(self)
        with self.mutex:
            self.connections.append(c)
        return c

to:

    def server(self):
        """Creates and returns a ServerConnection object."""

        c = self.connection_class(self)
        with self.mutex:
            self.connections.append(c)
        return c

to allow more modularity in the Reactor. However, the class-level reference to ServerConnection was causing the interpreter some confusion until I moved the ServerConnection above Reactor in the code, which is why github thinks the whole file was re-written.