From d21714a37fc222eaa5085f24962dc3377e9aa4ca Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 2 Oct 2013 15:36:37 -0500 Subject: [PATCH] Fix for network byte order issues in accelerate --- lib/ansible/runner/connection_plugins/accelerate.py | 4 ++-- library/utilities/accelerate | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/runner/connection_plugins/accelerate.py b/lib/ansible/runner/connection_plugins/accelerate.py index 413f85e606..3c4a4515b3 100644 --- a/lib/ansible/runner/connection_plugins/accelerate.py +++ b/lib/ansible/runner/connection_plugins/accelerate.py @@ -129,7 +129,7 @@ class Connection(object): return self def send_data(self, data): - packed_len = struct.pack('Q',len(data)) + packed_len = struct.pack('!Q',len(data)) return self.conn.sendall(packed_len + data) def recv_data(self): @@ -144,7 +144,7 @@ class Connection(object): return None data += d vvvv("%s: got the header, unpacking" % self.host) - data_len = struct.unpack('Q',data[:header_len])[0] + data_len = struct.unpack('!Q',data[:header_len])[0] data = data[header_len:] vvvv("%s: data received so far (expecting %d): %d" % (self.host,data_len,len(data))) while len(data) < data_len: diff --git a/library/utilities/accelerate b/library/utilities/accelerate index c0753125ea..6d50826bc4 100644 --- a/library/utilities/accelerate +++ b/library/utilities/accelerate @@ -190,7 +190,7 @@ class ThreadedTCPServer(SocketServer.ThreadingTCPServer): class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler): def send_data(self, data): - packed_len = struct.pack('Q', len(data)) + packed_len = struct.pack('!Q', len(data)) return self.request.sendall(packed_len + data) def recv_data(self): @@ -204,7 +204,7 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler): return None data += d vvvv("in recv_data(), got the header, unpacking") - data_len = struct.unpack('Q',data[:header_len])[0] + data_len = struct.unpack('!Q',data[:header_len])[0] data = data[header_len:] vvvv("data received so far (expecting %d): %d" % (data_len,len(data))) while len(data) < data_len: