[svn r75] Ran reindent.py over eventlet, it caught some places where the indentation was incorrect. Also change tpool_test to complete in finite time.
This commit is contained in:
@@ -28,9 +28,9 @@ import simplejson
|
|||||||
|
|
||||||
|
|
||||||
def safe_load(what):
|
def safe_load(what):
|
||||||
if not what:
|
if not what:
|
||||||
return None
|
return None
|
||||||
return simplejson.loads(what)
|
return simplejson.loads(what)
|
||||||
|
|
||||||
|
|
||||||
suite = httpc.HttpSuite(simplejson.dumps, safe_load, 'application/json')
|
suite = httpc.HttpSuite(simplejson.dumps, safe_load, 'application/json')
|
||||||
|
@@ -161,10 +161,10 @@ class ConnectionPool(Pool):
|
|||||||
together to do HTTP keepalive sockets without errors.
|
together to do HTTP keepalive sockets without errors.
|
||||||
"""
|
"""
|
||||||
def __init__(self, proto, netloc, use_proxy, min_size=0, max_size=4):
|
def __init__(self, proto, netloc, use_proxy, min_size=0, max_size=4):
|
||||||
self.proto = proto
|
self.proto = proto
|
||||||
self.netloc = netloc
|
self.netloc = netloc
|
||||||
self.use_proxy = use_proxy
|
self.use_proxy = use_proxy
|
||||||
Pool.__init__(self, min_size, max_size)
|
Pool.__init__(self, min_size, max_size)
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
return httpc.make_connection(self.proto, self.netloc, self.use_proxy)
|
return httpc.make_connection(self.proto, self.netloc, self.use_proxy)
|
||||||
|
@@ -309,10 +309,10 @@ not supported, so you have to know what has been exported.
|
|||||||
|
|
||||||
_dead_list = my_cp._dead_list
|
_dead_list = my_cp._dead_list
|
||||||
for dead_object in _dead_list.copy():
|
for dead_object in _dead_list.copy():
|
||||||
request = Request('del', {'id':dead_object})
|
request = Request('del', {'id':dead_object})
|
||||||
|
|
||||||
my_cp.make_request(request)
|
my_cp.make_request(request)
|
||||||
_dead_list.remove(dead_object)
|
_dead_list.remove(dead_object)
|
||||||
|
|
||||||
# Pass all public attributes across to find out if it is
|
# Pass all public attributes across to find out if it is
|
||||||
# callable or a simple attribute.
|
# callable or a simple attribute.
|
||||||
|
@@ -39,14 +39,14 @@ class yadda(object):
|
|||||||
def sender_loop(pfx):
|
def sender_loop(pfx):
|
||||||
n = 0
|
n = 0
|
||||||
obj = tpool.Proxy(yadda())
|
obj = tpool.Proxy(yadda())
|
||||||
while True:
|
while n < 10:
|
||||||
api.sleep(0)
|
api.sleep(0)
|
||||||
now = time.time()
|
now = time.time()
|
||||||
print "%s: send (%s,%s)" % (pfx,now,n)
|
print "%s: send (%s,%s)" % (pfx,now,n)
|
||||||
rv = obj.foo(now,n=n)
|
rv = obj.foo(now,n=n)
|
||||||
print "%s: recv %s" % (pfx, rv)
|
print "%s: recv %s" % (pfx, rv)
|
||||||
assert(n == rv)
|
assert(n == rv)
|
||||||
api.sleep(0.5)
|
api.sleep(0)
|
||||||
n += 1
|
n += 1
|
||||||
|
|
||||||
def test1():
|
def test1():
|
||||||
|
@@ -244,7 +244,7 @@ class wrapped_fd(object):
|
|||||||
|
|
||||||
def read(self, size=None):
|
def read(self, size=None):
|
||||||
if size is not None and not isinstance(size, (int, long)):
|
if size is not None and not isinstance(size, (int, long)):
|
||||||
raise TypeError('Expecting an int or long for size, got %s: %s' % (type(size), repr(size)))
|
raise TypeError('Expecting an int or long for size, got %s: %s' % (type(size), repr(size)))
|
||||||
buf, self.recvbuffer = self.recvbuffer, ''
|
buf, self.recvbuffer = self.recvbuffer, ''
|
||||||
lst = [buf]
|
lst = [buf]
|
||||||
if size is None:
|
if size is None:
|
||||||
|
Reference in New Issue
Block a user