Fakeserver check for \n in tcp stream, const name changed to TCP_PATTERN

This commit is contained in:
Dan g 2018-07-27 16:28:02 -04:00
parent 5599e9f73b
commit b24a3699a5

View file

@ -30,7 +30,7 @@ class FakeStatsdServer(tcpserver.TCPServer):
""" """
PATTERN = br'(?P<path>[^:]*):(?P<value>[^|]*)\|(?P<type>.*)$' TCP_PATTERN = br'(?P<path>[^:]*):(?P<value>[^|]*)\|(?P<type>.*)\n$'
def __init__(self, iol, protocol='udp'): def __init__(self, iol, protocol='udp'):
self.datagrams = [] self.datagrams = []
@ -71,7 +71,7 @@ class FakeStatsdServer(tcpserver.TCPServer):
def handle_stream(self, stream, address): def handle_stream(self, stream, address):
while True: while True:
try: try:
result = yield stream.read_until_regex(self.PATTERN) result = yield stream.read_until_regex(self.TCP_PATTERN)
except iostream.StreamClosedError: except iostream.StreamClosedError:
break break
else: else: