Skip to content

Commit 4ef66c5

Browse files
author
Sam Clements
committed
Fixed bug in TCPTransport.send
1 parent 8894179 commit 4ef66c5

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

riemann_client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""A Python Riemann client and command line tool"""
22

3-
__version__ = '3.0.0'
3+
__version__ = '3.0.1'
44
__author__ = 'Sam Clements <sam.clements@datasift.com>'

riemann_client/transport.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
import riemann_client.riemann_pb2
1010

1111

12+
def socket_recvall(socket, length, bufsize=4096):
13+
"""Recives bytes from a socket until the buffer is the requested length"""
14+
data = ""
15+
while len(data) < length:
16+
data += socket.recv(bufsize)
17+
return data
18+
19+
1220
class RiemannError(Exception):
1321
"""Error class for errors recived from the Riemann server"""
1422
pass
@@ -71,16 +79,9 @@ def send(self, message):
7179

7280
length = struct.unpack('!I', self.socket.recv(4))[0]
7381
response = riemann_client.riemann_pb2.Msg()
74-
response.ParseFromString(self.socket_recvall(socket, length))
82+
response.ParseFromString(socket_recvall(self.socket, length))
7583

7684
if not response.ok:
7785
raise RiemannError(response.error)
7886

7987
return response
80-
81-
@staticmethod
82-
def socket_recvall(socket, length, bufsize=4096):
83-
data = ""
84-
while len(data) < length:
85-
data += socket.recv(bufsize)
86-
return data

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name = "riemann-client",
8-
version = '3.0.0',
8+
version = '3.0.1',
99

1010
author = "Sam Clements",
1111
author_email = "sam.clements@datasift.com",

0 commit comments

Comments
 (0)