Commit 85cae740 authored by Zachary Seguin's avatar Zachary Seguin

Properly decode incoming stream; additional logging on message receipt

parent fbfa7894
......@@ -67,8 +67,8 @@ def follow_stream(connectto):
# Set a timeout of 2 minutes
sock.settimeout(60.0 * 2)
chunk = sock.recv(BUFFER_SIZE)
data = '{data}{chunk}'.format(data=data, chunk=chunk)
chunk = sock.recv(BUFFER_SIZE).decode('utf-8')
data = u'{data}{chunk}'.format(data=data, chunk=chunk)
print('{host}:{port} - Data received'.format(
host=connectto[0], port=connectto[1]))
......@@ -77,12 +77,12 @@ def follow_stream(connectto):
xml = data[0:eoo + len(END_TEXT)]
data = data[eoo + len(END_TEXT):]
print('{host}:{port} - Alert received, queuing for processing'.format(
host=connectto[0], port=connectto[1]))
print('{host}:{port} - Alert received, queuing for processing (len: {length})'.format(
host=connectto[0], port=connectto[1], length=len(xml)))
print('Exception in stream {host}:{port}'.format(
host=connectto[0], port=connectto[1]))
except Exception, err:
print('Exception in stream {host}:{port}: {error}'.format(
host=connectto[0], port=connectto[1], error=err))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment