def handle(self, string, respondCallback, peer):
     try:
         incoming = simplejson.loads(string)
         if incoming['cmd'] == 'handshake':
             with debug.logNetwork("Handling handshake"):
                 response = self.cmd_handshake(peer=peer, ** incoming['arguments'])
                 respondCallback(simplejson.dumps(response))
         else:
             transaction = debug.Transaction("Handling: %s" % incoming['cmd'])
             self._queue.put((incoming, peer, respondCallback, transaction))
     except Exception, e:
         logging.exception('Handling')
         response = dict(exceptionString=str(e), exceptionType=e.__class__.__name__)
         respondCallback(simplejson.dumps(response))
예제 #2
0
 def provideLabel(self, id, label):
     with debug.logNetwork("Providing label '%(label)s' to '%(id)s'" % dict(label=label, id=id)):
         self._server.provideLabel(id=id, label=label)