projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't use select.POLL* constants
[openvswitch]
/
python
/
ovs
/
poller.py
diff --git
a/python/ovs/poller.py
b/python/ovs/poller.py
index c04c9b36f2738c5d22af8674aa587be4c3b16873..7d15f3edb6a8b9cb3cde7b531898fdfc3925f627 100644
(file)
--- a/
python/ovs/poller.py
+++ b/
python/ovs/poller.py
@@
-20,6
+20,11
@@
import socket
vlog = ovs.vlog.Vlog("poller")
vlog = ovs.vlog.Vlog("poller")
+POLLIN = 0x001
+POLLOUT = 0x004
+POLLERR = 0x008
+POLLHUP = 0x010
+POLLNVAL = 0x020
# eventlet/gevent doesn't support select.poll. If select.poll is used,
# python interpreter is blocked as a whole instead of switching from the
# eventlet/gevent doesn't support select.poll. If select.poll is used,
# python interpreter is blocked as a whole instead of switching from the
@@
-39,12
+44,12
@@
class _SelectSelect(object):
if isinstance(fd, socket.socket):
fd = fd.fileno()
assert isinstance(fd, int)
if isinstance(fd, socket.socket):
fd = fd.fileno()
assert isinstance(fd, int)
- if events &
select.
POLLIN:
+ if events & POLLIN:
self.rlist.append(fd)
self.rlist.append(fd)
- events &= ~
select.
POLLIN
- if events &
select.
POLLOUT:
+ events &= ~POLLIN
+ if events & POLLOUT:
self.wlist.append(fd)
self.wlist.append(fd)
- events &= ~
select.
POLLOUT
+ events &= ~POLLOUT
if events:
self.xlist.append(fd)
if events:
self.xlist.append(fd)
@@
-63,13
+68,13
@@
class _SelectSelect(object):
# events_dict[fd] |= event
events_dict = {}
for fd in rlist:
# events_dict[fd] |= event
events_dict = {}
for fd in rlist:
- events_dict[fd] = events_dict.get(fd, 0) |
select.
POLLIN
+ events_dict[fd] = events_dict.get(fd, 0) | POLLIN
for fd in wlist:
for fd in wlist:
- events_dict[fd] = events_dict.get(fd, 0) |
select.
POLLOUT
+ events_dict[fd] = events_dict.get(fd, 0) | POLLOUT
for fd in xlist:
for fd in xlist:
- events_dict[fd] = events_dict.get(fd, 0) | (
select.
POLLERR |
-
select.
POLLHUP |
-
select.
POLLNVAL)
+ events_dict[fd] = events_dict.get(fd, 0) | (POLLERR |
+ POLLHUP |
+ POLLNVAL)
return events_dict.items()
return events_dict.items()
@@
-168,15
+173,15
@@
class Poller(object):
for fd, revents in events:
if revents != 0:
s = ""
for fd, revents in events:
if revents != 0:
s = ""
- if revents &
select.
POLLIN:
+ if revents & POLLIN:
s += "[POLLIN]"
s += "[POLLIN]"
- if revents &
select.
POLLOUT:
+ if revents & POLLOUT:
s += "[POLLOUT]"
s += "[POLLOUT]"
- if revents &
select.
POLLERR:
+ if revents & POLLERR:
s += "[POLLERR]"
s += "[POLLERR]"
- if revents &
select.
POLLHUP:
+ if revents & POLLHUP:
s += "[POLLHUP]"
s += "[POLLHUP]"
- if revents &
select.
POLLNVAL:
+ if revents & POLLNVAL:
s += "[POLLNVAL]"
vlog.dbg("%s on fd %d" % (s, fd))
s += "[POLLNVAL]"
vlog.dbg("%s on fd %d" % (s, fd))