Commit 83033bbf authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac420] More readable function signature

Using boolean parameter instead of cryptic flag-like one. It is less
flexible, but the flexibility isn't really needed.
parent 51d35705
......@@ -136,9 +136,11 @@ class MsgQ:
except AttributeError:
self.kqueue = select.kqueue()
def add_kqueue_socket(self, socket, additional_filters = 0):
event = select.kevent(socket.fileno(),
select.KQ_FILTER_READ | additional_filters,
def add_kqueue_socket(self, socket, enable_write = False):
filters = select.KQ_FILTER_READ
if enable_write:
filters |= select.KQ_FILTER_WRITE
event = select.kevent(socket.fileno(), filters,
select.KQ_EV_ADD | select.KQ_EV_ENABLE)
self.kqueue.control([event], 0)
......@@ -353,7 +355,7 @@ class MsgQ:
self.poller.register(fileno, select.POLLIN |
self.add_kqueue_socket(fileno, select.KQ_FILTER_WRITE)
self.add_kqueue_socket(fileno, True)
self.sendbuffs[fileno] = (last_sent, buff)
def __process_write(self, fileno):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment