From 9c2beffe8fb0823b661f8432b56c0a27a9fc5073 Mon Sep 17 00:00:00 2001 From: lovecat Date: Tue, 25 Aug 2015 11:46:12 +0800 Subject: [PATCH] statistic connection bytes before remove client. --- trunk/src/app/srs_app_rtmp_conn.cpp | 4 +--- trunk/src/app/srs_app_server.cpp | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index b4da91406..d7b5461eb 100755 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -210,9 +210,7 @@ int SrsRtmpConn::do_cycle() ret = service_cycle(); http_hooks_on_close(); - SrsStatistic* stat = SrsStatistic::instance(); - stat->on_disconnect(_srs_context->get_id()); - + return ret; } diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 5f2528eb3..3727a695e 100755 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -896,6 +896,7 @@ void SrsServer::remove(SrsConnection* conn) SrsStatistic* stat = SrsStatistic::instance(); stat->kbps_add_delta(conn); + stat->on_disconnect(conn->srs_id()); // all connections are created by server, // so we free it here.