Skip to content

Commit

Permalink
Merge pull request #606 from takazamy/master
Browse files Browse the repository at this point in the history
update bytesWritten, bytesRead on doneConnect
  • Loading branch information
illuspas authored Oct 14, 2023
2 parents a13c3b6 + 2778f6f commit 641e970
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/node_flv_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/node_rtmp_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

2 comments on commit 641e970

@twilson90
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this leads to an error for me:

uncaughtException TypeError: Cannot set property 'bytesWritten' of undefined
    at NodeRtmpSession.stop (/home/delete/web/cabtv.co.uk/livestreamer/node_modules/node-media-server/src/node_rtmp_session.js:221:39)
    at NodeRtmpSession.onSocketClose (/home/delete/web/cabtv.co.uk/livestreamer/node_modules/node-media-server/src/node_rtmp_session.js:243:10)
    at Socket.emit (events.js:315:20)
    at TCP.<anonymous> (net.js:673:12)

@JimFirby
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same error. Just tried to update from 2.6.2 to 2.6.6.

Please sign in to comment.