1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Upgrade amqp vendored library to 1.4.5

This commit is contained in:
Matthew Jones 2014-08-06 13:55:08 -04:00
parent efed138e8b
commit 6f6f8675f9
4 changed files with 73 additions and 27 deletions

View File

@ -1,7 +1,7 @@
Local versions of third-party packages required by Tower. Package names and
versions are listed below, along with notes on which files are included.
amqp==1.4.4 (amqp/*)
amqp==1.4.5 (amqp/*)
ansi2html==1.0.6 (ansi2html/*)
anyjson==0.3.3 (anyjson/*)
argparse==1.2.1 (argparse.py, needed for Python 2.6 support)

View File

@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
from __future__ import absolute_import
VERSION = (1, 4, 4)
VERSION = (1, 4, 5)
__version__ = '.'.join(map(str, VERSION[0:3])) + ''.join(VERSION[3:])
__author__ = 'Barry Pederson'
__maintainer__ = 'Ask Solem'

View File

@ -144,25 +144,62 @@ class AMQPReader(object):
def read_item(self):
ftype = ord(self.input.read(1))
if ftype == 83: # 'S'
# 'S': long string
if ftype == 83:
val = self.read_longstr()
elif ftype == 73: # 'I'
val = unpack('>i', self.input.read(4))[0]
elif ftype == 68: # 'D'
d = self.read_octet()
n = unpack('>i', self.input.read(4))[0]
val = Decimal(n) / Decimal(10 ** d)
elif ftype == 84: # 'T'
val = self.read_timestamp()
elif ftype == 70: # 'F'
val = self.read_table() # recurse
elif ftype == 65: # 'A'
val = self.read_array()
elif ftype == 116:
val = self.read_bit()
# 's': short string
elif ftype == 115:
val = self.read_shortstr()
# 'b': short-short int
elif ftype == 98:
val, = unpack('>B', self.input.read(1))
# 'B': short-short unsigned int
elif ftype == 66:
val, = unpack('>b', self.input.read(1))
# 'U': short int
elif ftype == 85:
val, = unpack('>h', self.input.read(2))
# 'u': short unsigned int
elif ftype == 117:
val, = unpack('>H', self.input.read(2))
# 'I': long int
elif ftype == 73:
val, = unpack('>i', self.input.read(4))
# 'i': long unsigned int
elif ftype == 105: # 'l'
val, = unpack('>I', self.input.read(4))
# 'L': long long int
elif ftype == 76:
val, = unpack('>q', self.input.read(8))
# 'l': long long unsigned int
elif ftype == 108:
val, = unpack('>Q', self.input.read(8))
# 'f': float
elif ftype == 102:
val, = unpack('>f', self.input.read(4))
# 'd': double
elif ftype == 100:
val = self.read_float()
elif ftype == 86: # 'V'
# 'D': decimal
elif ftype == 68:
d = self.read_octet()
n, = unpack('>i', self.input.read(4))
val = Decimal(n) / Decimal(10 ** d)
# 'F': table
elif ftype == 70:
val = self.read_table() # recurse
# 'A': array
elif ftype == 65:
val = self.read_array()
# 't' (bool)
elif ftype == 116:
val = self.read_bit()
# 'T': timestamp
elif ftype == 84:
val = self.read_timestamp()
# 'V': void
elif ftype == 86:
val = None
else:
raise FrameSyntaxError(

View File

@ -109,9 +109,13 @@ class _AbstractTransport(object):
def __del__(self):
try:
self.close()
except socket.error:
pass
# socket module may have been collected by gc
# if this is called by a thread at shutdown.
if socket is not None:
try:
self.close()
except socket.error:
pass
finally:
self.sock = None
@ -235,12 +239,17 @@ class SSLTransport(_AbstractTransport):
def _write(self, s):
"""Write a string out to the SSL socket fully."""
write = self.sock.write
while s:
n = write(s)
if not n:
raise IOError('Socket closed')
s = s[n:]
try:
write = self.sock.write
except AttributeError:
# Works around a bug in python socket library
raise IOError('Socket closed')
else:
while s:
n = write(s)
if not n:
raise IOError('Socket closed')
s = s[n:]
class TCPTransport(_AbstractTransport):