Importing patch from rfk to get green.zmq to respect NOBLOCK flag.

This commit is contained in:
Ryan Williams
2011-01-27 11:41:30 -08:00
parent 97da375d17
commit f443bf514b
2 changed files with 11 additions and 1 deletions

View File

@@ -69,3 +69,4 @@ Thanks To
* Anonymous, finding and fixing error in websocket chat example (#70) * Anonymous, finding and fixing error in websocket chat example (#70)
* Edward George, finding and fixing an issue in the [e]poll hubs (#74) * Edward George, finding and fixing an issue in the [e]poll hubs (#74)
* Ruijun Luo, figuring out incorrect openssl import for wrap_ssl (#73) * Ruijun Luo, figuring out incorrect openssl import for wrap_ssl (#73)
* rfk, patch to get green zmq to respect noblock flag.

View File

@@ -70,6 +70,9 @@ class Socket(__zmq__.Socket):
def _send_message(self, msg, flags=0): def _send_message(self, msg, flags=0):
if flags & __zmq__.NOBLOCK:
super(Socket,self)._send_message(msg, flags)
return
flags |= __zmq__.NOBLOCK flags |= __zmq__.NOBLOCK
while True: while True:
try: try:
@@ -81,6 +84,9 @@ class Socket(__zmq__.Socket):
trampoline(self, write=True) trampoline(self, write=True)
def _send_copy(self, msg, flags=0): def _send_copy(self, msg, flags=0):
if flags & __zmq__.NOBLOCK:
super(Socket,self)._send_copy(msg, flags)
return
flags |= __zmq__.NOBLOCK flags |= __zmq__.NOBLOCK
while True: while True:
try: try:
@@ -92,7 +98,8 @@ class Socket(__zmq__.Socket):
trampoline(self, write=True) trampoline(self, write=True)
def _recv_message(self, flags=0, track=False): def _recv_message(self, flags=0, track=False):
if flags & __zmq__.NOBLOCK:
return super(Socket,self)._recv_message(flags)
flags |= __zmq__.NOBLOCK flags |= __zmq__.NOBLOCK
while True: while True:
try: try:
@@ -105,6 +112,8 @@ class Socket(__zmq__.Socket):
trampoline(self, read=True) trampoline(self, read=True)
def _recv_copy(self, flags=0): def _recv_copy(self, flags=0):
if flags & __zmq__.NOBLOCK:
return super(Socket,self)._recv_copy(flags)
flags |= __zmq__.NOBLOCK flags |= __zmq__.NOBLOCK
while True: while True:
try: try: