Пример #1
0
 def run(self):
     while True:
         #if self._logger != None:
         #    self._logger.error('Waiting message')
         e = json.loads(self._unpickler.load())
         change = parse_file_change(e['ty'], e['pathname'], e['src_pathname'], e['context'], e['isdir'])
         #self._unpickler.memo = {}
         #if self._logger != None:
         #    self._logger.error('Message received')
         self._actor.tell({'command': 'forward', 'change': change})
Пример #2
0
 def run(self):
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.connect(('localhost', 5438))
     fs = s.makefile()
     fs.write(self._app_name + '\n')
     fs.flush()
     while True:
         line = fs.readline()[:-1]
         e = json.loads(line)
         change = parse_file_change(e['ty'], e['pathname'], e['src_pathname'], e['context'], e['isdir'])
         #self._unpickler.memo = {}
         if self._logger != None:
             self._logger.error('Message received')
         self._actor.tell({'command': 'forward', 'change': change})