Ejemplo n.º 1
0
class TrackbackService:
  def __init__(self):
    self.router=None

  def setRouter(self, r):
    self.router=r;
    self.handler=TrackbackHandler(self.router.keys)
    self.trackback=ServiceHandler(self.handler)

  def setPutPeerForEndpointCallback(self, key, callback):
    self.handler.setPutPeerForEndpointCallback(key, callback)

  def setPutInviteForPeerCallback(self, key, callback):
    self.handler.setPutInviteForPeer(key, callback)

  def setPutTrackerInviteCallback(self, callback):
    self.handler.setPutTrackerInvite(callback)

  def handle(self, msock, msg, addr):
    print('Trackback message from '+encodeAddress(addr)+':')
    self.trackback.handleRequest(msg.decode('utf-8'))
Ejemplo n.º 2
0
 def setRouter(self, r):
   self.router=r;
   self.handler=TrackbackHandler(self.router.keys)
   self.trackback=ServiceHandler(self.handler)
Ejemplo n.º 3
0
 def handle(self, msock, msg, addr):
     print('Tracker message from ' + encodeAddress(addr) + ':')
     trackback = ServiceHandler(TrackbackHandler(self.router))
     trackback.handleRequest(msg.decode('utf-8'))