From 2778f6f27c2b47c0a7e29bc9be9709e13d9bbb7b Mon Sep 17 00:00:00 2001 From: takazamy Date: Sat, 14 Oct 2023 10:32:42 +0700 Subject: [PATCH] update bytesWritten, bytesRead on doneConnect --- src/node_flv_session.js | 2 ++ src/node_rtmp_session.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/node_flv_session.js b/src/node_flv_session.js index e6ccdf1d..5ba8bfe6 100644 --- a/src/node_flv_session.js +++ b/src/node_flv_session.js @@ -91,6 +91,8 @@ class NodeFlvSession { } Logger.log(`[${this.TAG} play] Close stream. id=${this.id} streamPath=${this.playStreamPath}`); Logger.log(`[${this.TAG} disconnect] id=${this.id}`); + this.connectCmdObj.bytesWritten = this.res.socket.bytesWritten; + this.connectCmdObj.bytesRead = this.res.socket.bytesRead; context.nodeEvent.emit('doneConnect', this.id, this.connectCmdObj); this.res.end(); context.idlePlayers.delete(this.id); diff --git a/src/node_rtmp_session.js b/src/node_rtmp_session.js index e0da2d9a..cb0ec882 100644 --- a/src/node_rtmp_session.js +++ b/src/node_rtmp_session.js @@ -217,6 +217,9 @@ class NodeRtmpSession { } Logger.log(`[rtmp disconnect] id=${this.id}`); + + this.connectCmdObj.bytesWritten = this.socket.bytesWritten; + this.connectCmdObj.bytesRead = this.socket.bytesRead; context.nodeEvent.emit('doneConnect', this.id, this.connectCmdObj); context.sessions.delete(this.id);