Commit 8ed61b12 authored by i317280's avatar i317280

feat: record release

parent 39953fd1
......@@ -99,18 +99,19 @@ class ServerReplayRecorder(ReplayRecorder):
:return:
"""
# Todo: <liuzheng712@gmail.com>
self.file.write(str({'data': data['data'], 't': data['timestamp'] - self.starttime}))
self.file.write(',')
if len(data['data']) > 0:
self.file.write(
'"' + str(data['timestamp'] - self.starttime) + '":"' + data['data'].decode('utf-8', 'replace') + '",')
def session_start(self, session_id):
self.starttime = time.time()
self.file = open(os.path.join(
self.app.config['LOG_DIR'], session_id + '.replay'
), 'a')
self.file.write('[')
self.file.write('{')
def session_end(self, session_id):
self.file.write(']')
self.file.write('}')
self.file.close()
def push_to_server(self):
......
......@@ -121,7 +121,7 @@ class Session:
events = self.sel.select()
for sock in [key.fileobj for key, _ in events]:
data = sock.recv(BUF_SIZE)
self.put_replay(data)
# self.put_replay(data)
if sock == self.server:
if len(data) == 0:
msg = "Server close the connection"
......
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