hgext/inotify/server.py
changeset 8386 4aad982111b6
parent 8385 1536501ade62
child 8553 e387ecd7a6ed
equal deleted inserted replaced
8385:1536501ade62 8386:4aad982111b6
   587         sock, addr = self.sock.accept()
   587         sock, addr = self.sock.accept()
   588 
   588 
   589         cs = common.recvcs(sock)
   589         cs = common.recvcs(sock)
   590         version = ord(cs.read(1))
   590         version = ord(cs.read(1))
   591 
   591 
   592         sock.sendall(chr(common.version))
       
   593 
       
   594         if version != common.version:
   592         if version != common.version:
   595             self.ui.warn(_('received query from incompatible client '
   593             self.ui.warn(_('received query from incompatible client '
   596                            'version %d\n') % version)
   594                            'version %d\n') % version)
   597             return
   595             return
   598 
   596 
   636             'c' in states and genresult('n', self.repowatcher.tree) or [],
   634             'c' in states and genresult('n', self.repowatcher.tree) or [],
   637             ]]
   635             ]]
   638 
   636 
   639         try:
   637         try:
   640             try:
   638             try:
   641                 sock.sendall(struct.pack(common.resphdrfmt,
   639                 v = chr(common.version)
       
   640 
       
   641                 sock.sendall(v + struct.pack(common.resphdrfmts['STAT'],
   642                                          *map(len, results)))
   642                                          *map(len, results)))
   643                 sock.sendall(''.join(results))
   643                 sock.sendall(''.join(results))
   644             finally:
   644             finally:
   645                 sock.shutdown(socket.SHUT_WR)
   645                 sock.shutdown(socket.SHUT_WR)
   646         except socket.error, err:
   646         except socket.error, err: