##// END OF EJS Templates
inotify: put STAT-specific query answer generation part in its own method
Nicolas Dumazet -
r8554:47d73474 default
parent child Browse files
Show More
@@ -583,19 +583,7 b' class server(object):'
583 def handle_timeout(self):
583 def handle_timeout(self):
584 pass
584 pass
585
585
586 def handle_event(self, fd, event):
586 def answer_stat_query(self, cs):
587 sock, addr = self.sock.accept()
588
589 cs = common.recvcs(sock)
590 version = ord(cs.read(1))
591
592 if version != common.version:
593 self.ui.warn(_('received query from incompatible client '
594 'version %d\n') % version)
595 return
596
597 type = cs.read(4)
598
599 names = cs.read().split('\0')
587 names = cs.read().split('\0')
600
588
601 states = names.pop()
589 states = names.pop()
@@ -623,7 +611,7 b' class server(object):'
623 for f, s in self.repowatcher.walk(states, l, fn):
611 for f, s in self.repowatcher.walk(states, l, fn):
624 yield f
612 yield f
625
613
626 results = ['\0'.join(r) for r in [
614 return ['\0'.join(r) for r in [
627 genresult('l', self.repowatcher.statustrees['l']),
615 genresult('l', self.repowatcher.statustrees['l']),
628 genresult('m', self.repowatcher.statustrees['m']),
616 genresult('m', self.repowatcher.statustrees['m']),
629 genresult('a', self.repowatcher.statustrees['a']),
617 genresult('a', self.repowatcher.statustrees['a']),
@@ -636,6 +624,25 b' class server(object):'
636 'c' in states and genresult('n', self.repowatcher.tree) or [],
624 'c' in states and genresult('n', self.repowatcher.tree) or [],
637 ]]
625 ]]
638
626
627 def handle_event(self, fd, event):
628 sock, addr = self.sock.accept()
629
630 cs = common.recvcs(sock)
631 version = ord(cs.read(1))
632
633 if version != common.version:
634 self.ui.warn(_('received query from incompatible client '
635 'version %d\n') % version)
636 return
637
638 type = cs.read(4)
639
640 if type == 'STAT':
641 results = self.answer_stat_query(cs)
642 else:
643 self.ui.warn(_('unrecognized query type: %s\n') % type)
644 return
645
639 try:
646 try:
640 try:
647 try:
641 v = chr(common.version)
648 v = chr(common.version)
General Comments 0
You need to be logged in to leave comments. Login now