summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Bennett <matt@bennett.name>2017-02-17 19:28:25 +0000
committerSergey Shepelev <temotor@gmail.com>2017-04-12 12:19:01 +0300
commitfa87d413751740c2c4b0b881623dc984c640b565 (patch)
tree9d5f06493c957022741fb3ae1cfa4e4d576e0658
parent1a9b17c0f4e996490d6601b0c9896222c49bb4a1 (diff)
downloadeventlet-fa87d413751740c2c4b0b881623dc984c640b565.tar.gz
greendns: be explicit about expecting bytes from sock.recv
https://github.com/eventlet/eventlet/pull/391
-rw-r--r--eventlet/support/greendns.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/eventlet/support/greendns.py b/eventlet/support/greendns.py
index 2f1b8c3..ee9bc3d 100644
--- a/eventlet/support/greendns.py
+++ b/eventlet/support/greendns.py
@@ -603,13 +603,13 @@ def getnameinfo(sockaddr, flags):
def _net_read(sock, count, expiration):
- """coro friendly replacement for dns.query._net_write
+ """coro friendly replacement for dns.query._net_read
Read the specified number of bytes from sock. Keep trying until we
either get the desired amount, or we hit EOF.
A Timeout exception will be raised if the operation is not completed
by the expiration time.
"""
- s = ''
+ s = b''
while count > 0:
try:
n = sock.recv(count)
@@ -617,7 +617,7 @@ def _net_read(sock, count, expiration):
# Q: Do we also need to catch coro.CoroutineSocketWake and pass?
if expiration - time.time() <= 0.0:
raise dns.exception.Timeout
- if n == '':
+ if n == b'':
raise EOFError
count = count - len(n)
s = s + n