From 78f2ef8a81600d19d6d670803ef73747ab8d81b9 Mon Sep 17 00:00:00 2001 From: Sergey Shepelev Date: Thu, 2 Feb 2017 05:34:11 +0300 Subject: [PATCH] dns: EVENTLET_NO_GREENDNS option is back, green is still default Sorry for negation in name, perfectionists want EVENTLET_GREEN_DNS=no but I figured it's lesser evil than reviving same behavior under different name. This works around https://github.com/eventlet/eventlet/issues/383 at the cost of resolving blocking other greenthreads. --- eventlet/green/socket.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/eventlet/green/socket.py b/eventlet/green/socket.py index c97a573..6a39caf 100644 --- a/eventlet/green/socket.py +++ b/eventlet/green/socket.py @@ -1,6 +1,5 @@ import os import sys -import warnings __import__('eventlet.green._socket_nodns') __socket = sys.modules['eventlet.green._socket_nodns'] @@ -18,18 +17,13 @@ from eventlet.patcher import slurp_properties slurp_properties(__socket, globals(), srckeys=dir(__socket)) -if os.environ.get("EVENTLET_NO_GREENDNS", '').lower() == "yes": - warnings.warn( - 'EVENTLET_NO_GREENDNS is noop, dnspython is bundled and DNS resolution is always green', - DeprecationWarning, - stacklevel=2, - ) - -from eventlet.support import greendns -gethostbyname = greendns.gethostbyname -getaddrinfo = greendns.getaddrinfo -gethostbyname_ex = greendns.gethostbyname_ex -getnameinfo = greendns.getnameinfo +if os.environ.get("EVENTLET_NO_GREENDNS", '').lower() != 'yes': + from eventlet.support import greendns + gethostbyname = greendns.gethostbyname + getaddrinfo = greendns.getaddrinfo + gethostbyname_ex = greendns.gethostbyname_ex + getnameinfo = greendns.getnameinfo + del greendns def create_connection(address,