Skip to content

Commit

Permalink
close poll object after loop stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
clowwindy committed Aug 3, 2015
1 parent baad209 commit 58df1d8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions shadowsocks/eventloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def modify(self, fd, mode):
self.unregister(fd)
self.register(fd, mode)

def close(self):
self._kqueue.close()


class SelectLoop(object):

Expand Down Expand Up @@ -135,6 +138,9 @@ def modify(self, fd, mode):
self.unregister(fd)
self.register(fd, mode)

def close(self):
pass


class EventLoop(object):
def __init__(self):
Expand Down Expand Up @@ -216,6 +222,9 @@ def run(self):
callback()
self._last_time = now

def __del__(self):
self._impl.close()


# from tornado
def errno_from_exception(e):
Expand Down

0 comments on commit 58df1d8

Please sign in to comment.