winlin

refine http hooks, donot pass the known variable.

@@ -64,6 +64,8 @@ file @@ -64,6 +64,8 @@ file
64 ../../src/protocol/srs_rtmp_utility.hpp, 64 ../../src/protocol/srs_rtmp_utility.hpp,
65 ../../src/protocol/srs_rtmp_utility.cpp, 65 ../../src/protocol/srs_rtmp_utility.cpp,
66 app readonly separator, 66 app readonly separator,
  67 + ../../src/app/srs_app_async_call.hpp,
  68 + ../../src/app/srs_app_async_call.cpp,
67 ../../src/app/srs_app_bandwidth.hpp, 69 ../../src/app/srs_app_bandwidth.hpp,
68 ../../src/app/srs_app_bandwidth.cpp, 70 ../../src/app/srs_app_bandwidth.cpp,
69 ../../src/app/srs_app_conn.hpp, 71 ../../src/app/srs_app_conn.hpp,
@@ -520,13 +520,10 @@ int SrsDvrAsyncCallOnDvr::call() @@ -520,13 +520,10 @@ int SrsDvrAsyncCallOnDvr::call()
520 return ret; 520 return ret;
521 } 521 }
522 522
523 - int connection_id = _srs_context->get_id();  
524 - std::string ip = req->ip;  
525 - std::string cwd = _srs_config->cwd();  
526 std::string file = path; 523 std::string file = path;
527 for (int i = 0; i < (int)on_dvr->args.size(); i++) { 524 for (int i = 0; i < (int)on_dvr->args.size(); i++) {
528 std::string url = on_dvr->args.at(i); 525 std::string url = on_dvr->args.at(i);
529 - if ((ret = SrsHttpHooks::on_dvr(url, connection_id, ip, req, cwd, file)) != ERROR_SUCCESS) { 526 + if ((ret = SrsHttpHooks::on_dvr(url, req, file)) != ERROR_SUCCESS) {
530 srs_error("hook client on_dvr failed. url=%s, ret=%d", url.c_str(), ret); 527 srs_error("hook client on_dvr failed. url=%s, ret=%d", url.c_str(), ret);
531 return ret; 528 return ret;
532 } 529 }
@@ -195,13 +195,11 @@ int SrsDvrAsyncCallOnHls::call() @@ -195,13 +195,11 @@ int SrsDvrAsyncCallOnHls::call()
195 return ret; 195 return ret;
196 } 196 }
197 197
198 - int connection_id = _srs_context->get_id();  
199 - std::string cwd = _srs_config->cwd();  
200 std::string file = path; 198 std::string file = path;
201 int sn = seq_no; 199 int sn = seq_no;
202 for (int i = 0; i < (int)on_hls->args.size(); i++) { 200 for (int i = 0; i < (int)on_hls->args.size(); i++) {
203 std::string url = on_hls->args.at(i); 201 std::string url = on_hls->args.at(i);
204 - if ((ret = SrsHttpHooks::on_hls(url, connection_id, req, cwd, file, sn)) != ERROR_SUCCESS) { 202 + if ((ret = SrsHttpHooks::on_hls(url, req, file, sn)) != ERROR_SUCCESS) {
205 srs_error("hook client on_hls failed. url=%s, ret=%d", url.c_str(), ret); 203 srs_error("hook client on_hls failed. url=%s, ret=%d", url.c_str(), ret);
206 return ret; 204 return ret;
207 } 205 }
@@ -36,6 +36,7 @@ using namespace std; @@ -36,6 +36,7 @@ using namespace std;
36 #include <srs_app_dvr.hpp> 36 #include <srs_app_dvr.hpp>
37 #include <srs_app_http_client.hpp> 37 #include <srs_app_http_client.hpp>
38 #include <srs_core_autofree.hpp> 38 #include <srs_core_autofree.hpp>
  39 +#include <srs_app_config.hpp>
39 40
40 #define SRS_HTTP_RESPONSE_OK SRS_XSTR(ERROR_SUCCESS) 41 #define SRS_HTTP_RESPONSE_OK SRS_XSTR(ERROR_SUCCESS)
41 42
@@ -50,15 +51,17 @@ SrsHttpHooks::~SrsHttpHooks() @@ -50,15 +51,17 @@ SrsHttpHooks::~SrsHttpHooks()
50 { 51 {
51 } 52 }
52 53
53 -int SrsHttpHooks::on_connect(string url, int client_id, string ip, SrsRequest* req) 54 +int SrsHttpHooks::on_connect(string url, SrsRequest* req)
54 { 55 {
55 int ret = ERROR_SUCCESS; 56 int ret = ERROR_SUCCESS;
56 57
  58 + int client_id = _srs_context->get_id();
  59 +
57 std::stringstream ss; 60 std::stringstream ss;
58 ss << SRS_JOBJECT_START 61 ss << SRS_JOBJECT_START
59 << SRS_JFIELD_STR("action", "on_connect") << SRS_JFIELD_CONT 62 << SRS_JFIELD_STR("action", "on_connect") << SRS_JFIELD_CONT
60 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT 63 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
61 - << SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT 64 + << SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
62 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT 65 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
63 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT 66 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
64 << SRS_JFIELD_STR("tcUrl", req->tcUrl) << SRS_JFIELD_CONT 67 << SRS_JFIELD_STR("tcUrl", req->tcUrl) << SRS_JFIELD_CONT
@@ -82,15 +85,17 @@ int SrsHttpHooks::on_connect(string url, int client_id, string ip, SrsRequest* r @@ -82,15 +85,17 @@ int SrsHttpHooks::on_connect(string url, int client_id, string ip, SrsRequest* r
82 return ret; 85 return ret;
83 } 86 }
84 87
85 -void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes) 88 +void SrsHttpHooks::on_close(string url, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes)
86 { 89 {
87 int ret = ERROR_SUCCESS; 90 int ret = ERROR_SUCCESS;
88 91
  92 + int client_id = _srs_context->get_id();
  93 +
89 std::stringstream ss; 94 std::stringstream ss;
90 ss << SRS_JOBJECT_START 95 ss << SRS_JOBJECT_START
91 << SRS_JFIELD_STR("action", "on_close") << SRS_JFIELD_CONT 96 << SRS_JFIELD_STR("action", "on_close") << SRS_JFIELD_CONT
92 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT 97 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
93 - << SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT 98 + << SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
94 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT 99 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
95 << SRS_JFIELD_ORG("send_bytes", send_bytes) << SRS_JFIELD_CONT 100 << SRS_JFIELD_ORG("send_bytes", send_bytes) << SRS_JFIELD_CONT
96 << SRS_JFIELD_ORG("recv_bytes", recv_bytes) << SRS_JFIELD_CONT 101 << SRS_JFIELD_ORG("recv_bytes", recv_bytes) << SRS_JFIELD_CONT
@@ -114,15 +119,17 @@ void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* re @@ -114,15 +119,17 @@ void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* re
114 return; 119 return;
115 } 120 }
116 121
117 -int SrsHttpHooks::on_publish(string url, int client_id, string ip, SrsRequest* req) 122 +int SrsHttpHooks::on_publish(string url, SrsRequest* req)
118 { 123 {
119 int ret = ERROR_SUCCESS; 124 int ret = ERROR_SUCCESS;
120 125
  126 + int client_id = _srs_context->get_id();
  127 +
121 std::stringstream ss; 128 std::stringstream ss;
122 ss << SRS_JOBJECT_START 129 ss << SRS_JOBJECT_START
123 << SRS_JFIELD_STR("action", "on_publish") << SRS_JFIELD_CONT 130 << SRS_JFIELD_STR("action", "on_publish") << SRS_JFIELD_CONT
124 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT 131 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
125 - << SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT 132 + << SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
126 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT 133 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
127 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT 134 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
128 << SRS_JFIELD_STR("stream", req->stream) 135 << SRS_JFIELD_STR("stream", req->stream)
@@ -145,15 +152,17 @@ int SrsHttpHooks::on_publish(string url, int client_id, string ip, SrsRequest* r @@ -145,15 +152,17 @@ int SrsHttpHooks::on_publish(string url, int client_id, string ip, SrsRequest* r
145 return ret; 152 return ret;
146 } 153 }
147 154
148 -void SrsHttpHooks::on_unpublish(string url, int client_id, string ip, SrsRequest* req) 155 +void SrsHttpHooks::on_unpublish(string url, SrsRequest* req)
149 { 156 {
150 int ret = ERROR_SUCCESS; 157 int ret = ERROR_SUCCESS;
151 158
  159 + int client_id = _srs_context->get_id();
  160 +
152 std::stringstream ss; 161 std::stringstream ss;
153 ss << SRS_JOBJECT_START 162 ss << SRS_JOBJECT_START
154 << SRS_JFIELD_STR("action", "on_unpublish") << SRS_JFIELD_CONT 163 << SRS_JFIELD_STR("action", "on_unpublish") << SRS_JFIELD_CONT
155 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT 164 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
156 - << SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT 165 + << SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
157 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT 166 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
158 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT 167 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
159 << SRS_JFIELD_STR("stream", req->stream) 168 << SRS_JFIELD_STR("stream", req->stream)
@@ -176,15 +185,17 @@ void SrsHttpHooks::on_unpublish(string url, int client_id, string ip, SrsRequest @@ -176,15 +185,17 @@ void SrsHttpHooks::on_unpublish(string url, int client_id, string ip, SrsRequest
176 return; 185 return;
177 } 186 }
178 187
179 -int SrsHttpHooks::on_play(string url, int client_id, string ip, SrsRequest* req) 188 +int SrsHttpHooks::on_play(string url, SrsRequest* req)
180 { 189 {
181 int ret = ERROR_SUCCESS; 190 int ret = ERROR_SUCCESS;
182 191
  192 + int client_id = _srs_context->get_id();
  193 +
183 std::stringstream ss; 194 std::stringstream ss;
184 ss << SRS_JOBJECT_START 195 ss << SRS_JOBJECT_START
185 << SRS_JFIELD_STR("action", "on_play") << SRS_JFIELD_CONT 196 << SRS_JFIELD_STR("action", "on_play") << SRS_JFIELD_CONT
186 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT 197 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
187 - << SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT 198 + << SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
188 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT 199 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
189 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT 200 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
190 << SRS_JFIELD_STR("stream", req->stream) 201 << SRS_JFIELD_STR("stream", req->stream)
@@ -207,15 +218,17 @@ int SrsHttpHooks::on_play(string url, int client_id, string ip, SrsRequest* req) @@ -207,15 +218,17 @@ int SrsHttpHooks::on_play(string url, int client_id, string ip, SrsRequest* req)
207 return ret; 218 return ret;
208 } 219 }
209 220
210 -void SrsHttpHooks::on_stop(string url, int client_id, string ip, SrsRequest* req) 221 +void SrsHttpHooks::on_stop(string url, SrsRequest* req)
211 { 222 {
212 int ret = ERROR_SUCCESS; 223 int ret = ERROR_SUCCESS;
213 224
  225 + int client_id = _srs_context->get_id();
  226 +
214 std::stringstream ss; 227 std::stringstream ss;
215 ss << SRS_JOBJECT_START 228 ss << SRS_JOBJECT_START
216 << SRS_JFIELD_STR("action", "on_stop") << SRS_JFIELD_CONT 229 << SRS_JFIELD_STR("action", "on_stop") << SRS_JFIELD_CONT
217 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT 230 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
218 - << SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT 231 + << SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
219 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT 232 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
220 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT 233 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
221 << SRS_JFIELD_STR("stream", req->stream) 234 << SRS_JFIELD_STR("stream", req->stream)
@@ -238,15 +251,18 @@ void SrsHttpHooks::on_stop(string url, int client_id, string ip, SrsRequest* req @@ -238,15 +251,18 @@ void SrsHttpHooks::on_stop(string url, int client_id, string ip, SrsRequest* req
238 return; 251 return;
239 } 252 }
240 253
241 -int SrsHttpHooks::on_dvr(string url, int client_id, string ip, SrsRequest* req, string cwd, string file) 254 +int SrsHttpHooks::on_dvr(string url, SrsRequest* req, string file)
242 { 255 {
243 int ret = ERROR_SUCCESS; 256 int ret = ERROR_SUCCESS;
244 257
  258 + int client_id = _srs_context->get_id();
  259 + std::string cwd = _srs_config->cwd();
  260 +
245 std::stringstream ss; 261 std::stringstream ss;
246 ss << SRS_JOBJECT_START 262 ss << SRS_JOBJECT_START
247 << SRS_JFIELD_STR("action", "on_dvr") << SRS_JFIELD_CONT 263 << SRS_JFIELD_STR("action", "on_dvr") << SRS_JFIELD_CONT
248 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT 264 << SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
249 - << SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT 265 + << SRS_JFIELD_STR("ip", req->ip) << SRS_JFIELD_CONT
250 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT 266 << SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
251 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT 267 << SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
252 << SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_CONT 268 << SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_CONT
@@ -271,10 +287,13 @@ int SrsHttpHooks::on_dvr(string url, int client_id, string ip, SrsRequest* req, @@ -271,10 +287,13 @@ int SrsHttpHooks::on_dvr(string url, int client_id, string ip, SrsRequest* req,
271 return ret; 287 return ret;
272 } 288 }
273 289
274 -int SrsHttpHooks::on_hls(string url, int client_id, SrsRequest* req, string cwd, string file, int sn) 290 +int SrsHttpHooks::on_hls(string url, SrsRequest* req, string file, int sn)
275 { 291 {
276 int ret = ERROR_SUCCESS; 292 int ret = ERROR_SUCCESS;
277 293
  294 + int client_id = _srs_context->get_id();
  295 + std::string cwd = _srs_config->cwd();
  296 +
278 std::stringstream ss; 297 std::stringstream ss;
279 ss << SRS_JOBJECT_START 298 ss << SRS_JOBJECT_START
280 << SRS_JFIELD_STR("action", "on_hls") << SRS_JFIELD_CONT 299 << SRS_JFIELD_STR("action", "on_hls") << SRS_JFIELD_CONT
@@ -55,65 +55,55 @@ public: @@ -55,65 +55,55 @@ public:
55 public: 55 public:
56 /** 56 /**
57 * on_connect hook, when client connect to srs. 57 * on_connect hook, when client connect to srs.
58 - * @param client_id the id of client on server.  
59 * @param url the api server url, to valid the client. 58 * @param url the api server url, to valid the client.
60 * ignore if empty. 59 * ignore if empty.
61 */ 60 */
62 - static int on_connect(std::string url, int client_id, std::string ip, SrsRequest* req); 61 + static int on_connect(std::string url, SrsRequest* req);
63 /** 62 /**
64 * on_close hook, when client disconnect to srs, where client is valid by on_connect. 63 * on_close hook, when client disconnect to srs, where client is valid by on_connect.
65 - * @param client_id the id of client on server.  
66 * @param url the api server url, to process the event. 64 * @param url the api server url, to process the event.
67 * ignore if empty. 65 * ignore if empty.
68 */ 66 */
69 - static void on_close(std::string url, int client_id, std::string ip, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes); 67 + static void on_close(std::string url, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes);
70 /** 68 /**
71 * on_publish hook, when client(encoder) start to publish stream 69 * on_publish hook, when client(encoder) start to publish stream
72 - * @param client_id the id of client on server.  
73 * @param url the api server url, to valid the client. 70 * @param url the api server url, to valid the client.
74 * ignore if empty. 71 * ignore if empty.
75 */ 72 */
76 - static int on_publish(std::string url, int client_id, std::string ip, SrsRequest* req); 73 + static int on_publish(std::string url, SrsRequest* req);
77 /** 74 /**
78 * on_unpublish hook, when client(encoder) stop publish stream. 75 * on_unpublish hook, when client(encoder) stop publish stream.
79 - * @param client_id the id of client on server.  
80 * @param url the api server url, to process the event. 76 * @param url the api server url, to process the event.
81 * ignore if empty. 77 * ignore if empty.
82 */ 78 */
83 - static void on_unpublish(std::string url, int client_id, std::string ip, SrsRequest* req); 79 + static void on_unpublish(std::string url, SrsRequest* req);
84 /** 80 /**
85 * on_play hook, when client start to play stream. 81 * on_play hook, when client start to play stream.
86 - * @param client_id the id of client on server.  
87 * @param url the api server url, to valid the client. 82 * @param url the api server url, to valid the client.
88 * ignore if empty. 83 * ignore if empty.
89 */ 84 */
90 - static int on_play(std::string url, int client_id, std::string ip, SrsRequest* req); 85 + static int on_play(std::string url, SrsRequest* req);
91 /** 86 /**
92 * on_stop hook, when client stop to play the stream. 87 * on_stop hook, when client stop to play the stream.
93 - * @param client_id the id of client on server.  
94 * @param url the api server url, to process the event. 88 * @param url the api server url, to process the event.
95 * ignore if empty. 89 * ignore if empty.
96 */ 90 */
97 - static void on_stop(std::string url, int client_id, std::string ip, SrsRequest* req); 91 + static void on_stop(std::string url, SrsRequest* req);
98 /** 92 /**
99 * on_dvr hook, when reap a dvr file. 93 * on_dvr hook, when reap a dvr file.
100 - * @param client_id the id of client on server.  
101 * @param url the api server url, to process the event. 94 * @param url the api server url, to process the event.
102 * ignore if empty. 95 * ignore if empty.
103 - * @param cwd the current work directory, used to resolve the reltive file path.  
104 * @param file the file path, can be relative or absolute path. 96 * @param file the file path, can be relative or absolute path.
105 */ 97 */
106 - static int on_dvr(std::string url, int client_id, std::string ip, SrsRequest* req, std::string cwd, std::string file); 98 + static int on_dvr(std::string url, SrsRequest* req, std::string file);
107 /** 99 /**
108 * when hls reap segment, callback. 100 * when hls reap segment, callback.
109 - * @param client_id the id of client on server.  
110 * @param url the api server url, to process the event. 101 * @param url the api server url, to process the event.
111 * ignore if empty. 102 * ignore if empty.
112 - * @param cwd the current work directory, used to resolve the reltive file path.  
113 * @param file the ts file path, can be relative or absolute path. 103 * @param file the ts file path, can be relative or absolute path.
114 * @param sn the seq_no, the sequence number of ts in hls/m3u8. 104 * @param sn the seq_no, the sequence number of ts in hls/m3u8.
115 */ 105 */
116 - static int on_hls(std::string url, int client_id, SrsRequest* req, std::string cwd, std::string file, int sn); 106 + static int on_hls(std::string url, SrsRequest* req, std::string file, int sn);
117 private: 107 private:
118 static int do_post(std::string url, std::string req, int& code, std::string& res); 108 static int do_post(std::string url, std::string req, int& code, std::string& res);
119 }; 109 };
@@ -1265,10 +1265,9 @@ int SrsRtmpConn::http_hooks_on_connect() @@ -1265,10 +1265,9 @@ int SrsRtmpConn::http_hooks_on_connect()
1265 return ret; 1265 return ret;
1266 } 1266 }
1267 1267
1268 - int connection_id = _srs_context->get_id();  
1269 for (int i = 0; i < (int)on_connect->args.size(); i++) { 1268 for (int i = 0; i < (int)on_connect->args.size(); i++) {
1270 std::string url = on_connect->args.at(i); 1269 std::string url = on_connect->args.at(i);
1271 - if ((ret = SrsHttpHooks::on_connect(url, connection_id, ip, req)) != ERROR_SUCCESS) { 1270 + if ((ret = SrsHttpHooks::on_connect(url, req)) != ERROR_SUCCESS) {
1272 srs_error("hook client on_connect failed. url=%s, ret=%d", url.c_str(), ret); 1271 srs_error("hook client on_connect failed. url=%s, ret=%d", url.c_str(), ret);
1273 return ret; 1272 return ret;
1274 } 1273 }
@@ -1291,10 +1290,9 @@ void SrsRtmpConn::http_hooks_on_close() @@ -1291,10 +1290,9 @@ void SrsRtmpConn::http_hooks_on_close()
1291 return; 1290 return;
1292 } 1291 }
1293 1292
1294 - int connection_id = _srs_context->get_id();  
1295 for (int i = 0; i < (int)on_close->args.size(); i++) { 1293 for (int i = 0; i < (int)on_close->args.size(); i++) {
1296 std::string url = on_close->args.at(i); 1294 std::string url = on_close->args.at(i);
1297 - SrsHttpHooks::on_close(url, connection_id, ip, req, kbps->get_send_bytes(), kbps->get_recv_bytes()); 1295 + SrsHttpHooks::on_close(url, req, kbps->get_send_bytes(), kbps->get_recv_bytes());
1298 } 1296 }
1299 } 1297 }
1300 #endif 1298 #endif
@@ -1313,10 +1311,9 @@ int SrsRtmpConn::http_hooks_on_publish() @@ -1313,10 +1311,9 @@ int SrsRtmpConn::http_hooks_on_publish()
1313 return ret; 1311 return ret;
1314 } 1312 }
1315 1313
1316 - int connection_id = _srs_context->get_id();  
1317 for (int i = 0; i < (int)on_publish->args.size(); i++) { 1314 for (int i = 0; i < (int)on_publish->args.size(); i++) {
1318 std::string url = on_publish->args.at(i); 1315 std::string url = on_publish->args.at(i);
1319 - if ((ret = SrsHttpHooks::on_publish(url, connection_id, ip, req)) != ERROR_SUCCESS) { 1316 + if ((ret = SrsHttpHooks::on_publish(url, req)) != ERROR_SUCCESS) {
1320 srs_error("hook client on_publish failed. url=%s, ret=%d", url.c_str(), ret); 1317 srs_error("hook client on_publish failed. url=%s, ret=%d", url.c_str(), ret);
1321 return ret; 1318 return ret;
1322 } 1319 }
@@ -1339,10 +1336,9 @@ void SrsRtmpConn::http_hooks_on_unpublish() @@ -1339,10 +1336,9 @@ void SrsRtmpConn::http_hooks_on_unpublish()
1339 return; 1336 return;
1340 } 1337 }
1341 1338
1342 - int connection_id = _srs_context->get_id();  
1343 for (int i = 0; i < (int)on_unpublish->args.size(); i++) { 1339 for (int i = 0; i < (int)on_unpublish->args.size(); i++) {
1344 std::string url = on_unpublish->args.at(i); 1340 std::string url = on_unpublish->args.at(i);
1345 - SrsHttpHooks::on_unpublish(url, connection_id, ip, req); 1341 + SrsHttpHooks::on_unpublish(url, req);
1346 } 1342 }
1347 } 1343 }
1348 #endif 1344 #endif
@@ -1361,10 +1357,9 @@ int SrsRtmpConn::http_hooks_on_play() @@ -1361,10 +1357,9 @@ int SrsRtmpConn::http_hooks_on_play()
1361 return ret; 1357 return ret;
1362 } 1358 }
1363 1359
1364 - int connection_id = _srs_context->get_id();  
1365 for (int i = 0; i < (int)on_play->args.size(); i++) { 1360 for (int i = 0; i < (int)on_play->args.size(); i++) {
1366 std::string url = on_play->args.at(i); 1361 std::string url = on_play->args.at(i);
1367 - if ((ret = SrsHttpHooks::on_play(url, connection_id, ip, req)) != ERROR_SUCCESS) { 1362 + if ((ret = SrsHttpHooks::on_play(url, req)) != ERROR_SUCCESS) {
1368 srs_error("hook client on_play failed. url=%s, ret=%d", url.c_str(), ret); 1363 srs_error("hook client on_play failed. url=%s, ret=%d", url.c_str(), ret);
1369 return ret; 1364 return ret;
1370 } 1365 }
@@ -1387,10 +1382,9 @@ void SrsRtmpConn::http_hooks_on_stop() @@ -1387,10 +1382,9 @@ void SrsRtmpConn::http_hooks_on_stop()
1387 return; 1382 return;
1388 } 1383 }
1389 1384
1390 - int connection_id = _srs_context->get_id();  
1391 for (int i = 0; i < (int)on_stop->args.size(); i++) { 1385 for (int i = 0; i < (int)on_stop->args.size(); i++) {
1392 std::string url = on_stop->args.at(i); 1386 std::string url = on_stop->args.at(i);
1393 - SrsHttpHooks::on_stop(url, connection_id, ip, req); 1387 + SrsHttpHooks::on_stop(url, req);
1394 } 1388 }
1395 } 1389 }
1396 #endif 1390 #endif