-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbroker.py
More file actions
30 lines (24 loc) · 857 Bytes
/
Copy pathbroker.py
File metadata and controls
30 lines (24 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from twisted.internet import reactor, protocol
import sys
from peer_manager import PeerManager
from client_manager import ClientManager
from util import Log
import config
class Broker:
def __init__(self):
"""
Initilize peerManager and clientManager which are responsible for
managing the connections to peers and clients
"""
self.peerManager = PeerManager()
self.clientManager = ClientManager()
self.peerManager.AddPeerFromFile(config.BR_PEER_LIST)
self.peerManager.ListenTCP()
self.peerManager.ConnectPeers()
self.clientManager.ListenTCP()
self.peerManager.clientManager = self.clientManager
self.clientManager.peerManager = self.peerManager
if __name__ == '__main__':
broker = Broker()
Log.StartLogging(sys.stdout)
reactor.run()