Skip to content

Commit

Permalink
Fix for network byte order issues in accelerate
Browse files Browse the repository at this point in the history
  • Loading branch information
jimi-c committed Oct 2, 2013
1 parent df529b9 commit d21714a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/ansible/runner/connection_plugins/accelerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def connect(self, allow_ssh=True):
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):
Expand All @@ -144,7 +144,7 @@ def recv_data(self):
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:
Expand Down
4 changes: 2 additions & 2 deletions library/utilities/accelerate
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down

0 comments on commit d21714a

Please sign in to comment.