inotify: handle_event: do not use event and fd parameters.
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Thu, 21 May 2009 16:54:05 +0900
changeset 8607 e17eba98c789
parent 8606 1c5752dabf76
child 8608 228db070bfc4
inotify: handle_event: do not use event and fd parameters. event is particularly confusing given the context (is it an inotify event? a polling event?) and is never used. Remove it. fd has very little use, and it gives the false impression that event handling depends on fd. It's wrong: the same behavior is triggered, for all events.
hgext/inotify/server.py
--- a/hgext/inotify/server.py	Fri May 22 10:26:56 2009 +0900
+++ b/hgext/inotify/server.py	Thu May 21 16:54:05 2009 +0900
@@ -500,7 +500,7 @@
                      evt.fullpath)
         sys.exit(0)
 
-    def handle_event(self, fd, event):
+    def handle_event(self):
         if self.ui.debugflag:
             self.ui.note(_('%s readable: %d bytes\n') %
                          (self.event_time(), self.threshold.readable()))
@@ -509,7 +509,7 @@
                 if self.ui.debugflag:
                     self.ui.note(_('%s below threshold - unhooking\n') %
                                  (self.event_time()))
-                self.master.poll.unregister(fd)
+                self.master.poll.unregister(self.fileno())
                 self.registered = False
                 self.timeout = 250
         else:
@@ -640,7 +640,7 @@
     def answer_dbug_query(self):
         return ['\0'.join(self.repowatcher.debug())]
 
-    def handle_event(self, fd, event):
+    def handle_event(self):
         sock, addr = self.sock.accept()
 
         cs = common.recvcs(sock)
@@ -729,7 +729,7 @@
                 raise
             if events:
                 for fd, event in events:
-                    self.table[fd].handle_event(fd, event)
+                    self.table[fd].handle_event()
             elif timeobj:
                 timeobj.handle_timeout()