fdopen: Use better "is using eventlet" test
The earlier[*] fdopen/GreenPipe workaround is ineffective in nova, since it uses the wrong guard predicate. Nova doesn't monkey_patch `os`, so this change switches to checking against `socket` module instead. Neither of these is strictly "correct" for our os.pipe/fdopen case, but we just want to get some indication of "is eventlet being used". [*] fdopen change: I4a6c0d4247aca17536316fb0ab163241ad545b20 Change-Id: I2bba4c45a66f49d5014f218a0ce24f221c9196bd
This commit is contained in:
parent
eb9ed356a3
commit
b9a9d412d7
|
@ -185,7 +185,7 @@ def fdopen(fd, *args, **kwargs):
|
|||
# are broken in lots of ways regarding blocking behaviour. We
|
||||
# *need* the newer io.* objects on py2 (doesn't matter on py3,
|
||||
# since the old file code has been replaced with io.*)
|
||||
if eventlet.patcher.is_monkey_patched('os'):
|
||||
if eventlet.patcher.is_monkey_patched('socket'):
|
||||
return eventlet.greenio.GreenPipe(fd, *args, **kwargs)
|
||||
else:
|
||||
return io.open(fd, *args, **kwargs)
|
||||
|
|
Loading…
Reference in New Issue