Skip to content

Commit

Permalink
Merge pull request Janhouse#4 from ruffyen/master
Browse files Browse the repository at this point in the history
Fixed bug I was having with a server near me that had a latency of 0ms
Cleaning up
  • Loading branch information
Janhouse committed Nov 2, 2012
2 parents 79e2957 + 23b5c94 commit bcbbc64
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions tespeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
# Copyright 2012 Janis Jansons ([email protected])
#

import os
import urllib
import urllib2
import gzip
import sys
from multiprocessing import Process, Pipe, Manager
from lxml import etree
import time
import gzip
import time
import string
import random
from math import radians, cos, sin, asin, sqrt

from StringIO import StringIO
Expand Down Expand Up @@ -136,7 +131,7 @@ def TestLatency(self, servers):
for server in servers:
now=self.TestSingleLatency(server['url']+"latency.txt?x=" + str( time.time() ))*1000
now=now/2 # Evil hack or just pure stupidity? Nobody knows...
if now == -1:
if now == -1 or now == 0:
continue
print "%0.0f ms latency for %s (%s, %s, %s) [%0.2f km]" % (now, server['url'], server['sponsor'], server['name'], server['country'], server['distance'])

Expand Down Expand Up @@ -445,4 +440,3 @@ def main(argv):

if __name__ == '__main__':
main(sys.argv)

0 comments on commit bcbbc64

Please sign in to comment.