OpenBazaar/OpenBazaar — pull request #678 by yagoulas (2014-09-25 12:40:15+00:00)
Title: Listener refactor

Factor classes `PeerListener` and `CryptoPeerListener` out of `TransportLayer` and `CryptoTransportLayer`

* It turns out that everyone uses `TransportLayer` as a class to put every method or attribute when it isn't known where it really belongs and as a result this class is bloated with all sort of different things including the code that manages sockets, listening for requests and handling all sort of crypto code here and there.
* This is the first of a series of attempts to try to reduce the bloat and factor the code in `TransportLayer` into several classes that are smaller, simpler, maintainable and most importantly easier to test.
* The new classes were designed having in mind `PeerSender` and `CryptoPeerSender` trying to do better in some designing decisions. The new classes are completely independent from `dht.py` and `transport.py`. Sender classes have this problem and should be refactored in the future. The new classes try to be as clean as possible and follow practices like defining all members in constructors.
* As the *Sender classes get a dictionary that is then encrypted, compressed and sent, the listener classes do the inverse actions and receive, decompress and decrypt the messages, relaying the sent dictionaries to the receiver.