The fastestmirror plugin tries to find the fastest mirror
by timing a null TCP connect(), so usually 2x RTT.

However, the value measured includes host DNS lookup overhead,
which is completely unrelated.  So, perform it outside
the connect() statement.
---
 plugins/fastestmirror/fastestmirror.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/plugins/fastestmirror/fastestmirror.py 
b/plugins/fastestmirror/fastestmirror.py
index 364b90d..acec946 100644
--- a/plugins/fastestmirror/fastestmirror.py
+++ b/plugins/fastestmirror/fastestmirror.py
@@ -503,8 +503,9 @@ class PollThread(threading.Thread):
                     if uPort > 0:
                         self.port = int(self.host[uPort+1:])
                         self.host = self.host[:uPort]
+                    host_addr = socket.gethostbyname(self.host)
                     time_before = time.time()
-                    sock.connect((self.host, self.port))
+                    sock.connect((host_addr, self.port))
                     result = time.time() - time_before
                     sock.close()
             self.parent._add_result(self.mirror, self.host, result)
-- 
1.7.4.4

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to