Nimrod A. Abing (on kohima)
Committed by winlin

Modified on_close webhook.

Pass the send_bytes and recv_bytes count to the web hook.
... ... @@ -82,7 +82,7 @@ int SrsHttpHooks::on_connect(string url, int client_id, string ip, SrsRequest* r
return ret;
}
void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* req)
void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes)
{
int ret = ERROR_SUCCESS;
... ... @@ -92,6 +92,8 @@ void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* re
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("send_bytes", send_bytes) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_ORG("recv_bytes", recv_bytes) << __SRS_JFIELD_CONT
<< __SRS_JFIELD_STR("app", req->app)
<< __SRS_JOBJECT_END;
... ...
... ... @@ -66,7 +66,7 @@ public:
* @param url the api server url, to process the event.
* ignore if empty.
*/
static void on_close(std::string url, int client_id, std::string ip, SrsRequest* req);
static void on_close(std::string url, int client_id, std::string ip, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes);
/**
* on_publish hook, when client(encoder) start to publish stream
* @param client_id the id of client on server.
... ...
... ... @@ -1294,7 +1294,7 @@ void SrsRtmpConn::http_hooks_on_close()
int connection_id = _srs_context->get_id();
for (int i = 0; i < (int)on_close->args.size(); i++) {
std::string url = on_close->args.at(i);
SrsHttpHooks::on_close(url, connection_id, ip, req);
SrsHttpHooks::on_close(url, connection_id, ip, req, skt->get_send_bytes(), skt->get_recv_bytes());
}
}
#endif
... ...