Skip to content

Commit a00554a

Browse files
author
Haibo Chen
committed
rename secret
1 parent 1789f54 commit a00554a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

trunk/src/app/srs_app_http_static.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,32 +236,32 @@ srs_error_t SrsVodStream::serve_m3u8_ctx(ISrsHttpResponseWriter * w, ISrsHttpMes
236236
return srs_error_wrap(err, "final request");
237237
}
238238

239+
alive(ctx, req->copy());
240+
239241
// update the statistic when source disconveried.
240242
SrsStatistic* stat = SrsStatistic::instance();
241243
if ((err = stat->on_client(ctx, req, NULL, SrsRtmpConnPlay)) != srs_success) {
242244
return srs_error_wrap(err, "stat on client");
243245
}
244246

245-
alive(ctx, req->copy());
246-
247247
return err;
248248
}
249249

250-
bool SrsVodStream::ctx_is_exist(std::string secret)
250+
bool SrsVodStream::ctx_is_exist(std::string ctx)
251251
{
252-
return (map_ctx_info_.find(secret) != map_ctx_info_.end());
252+
return (map_ctx_info_.find(ctx) != map_ctx_info_.end());
253253
}
254254

255-
void SrsVodStream::alive(std::string secret, SrsRequest* req)
255+
void SrsVodStream::alive(std::string ctx, SrsRequest* req)
256256
{
257257
std::map<std::string, SrsM3u8CtxInfo>::iterator it;
258-
if ((it = map_ctx_info_.find(secret)) != map_ctx_info_.end()) {
258+
if ((it = map_ctx_info_.find(ctx)) != map_ctx_info_.end()) {
259259
it->second.request_time = srs_get_system_time();
260260
} else {
261261
SrsM3u8CtxInfo info;
262262
info.req = req;
263263
info.request_time = srs_get_system_time();
264-
map_ctx_info_.insert(make_pair(secret, info));
264+
map_ctx_info_.insert(make_pair(ctx, info));
265265
}
266266
}
267267

@@ -334,15 +334,15 @@ srs_error_t SrsVodStream::on_timer(srs_utime_t interval)
334334

335335
std::map<std::string, SrsM3u8CtxInfo>::iterator it;
336336
for (it = map_ctx_info_.begin(); it != map_ctx_info_.end(); ++it) {
337-
string secret = it->first;
337+
string ctx = it->first;
338338
SrsRequest* req = it->second.req;
339339
srs_utime_t hls_window = _srs_config->get_hls_window(req->vhost);
340340
if (it->second.request_time + (2 * hls_window) < srs_get_system_time()) {
341341
http_hooks_on_stop(req);
342342
srs_freep(req);
343343

344344
SrsStatistic* stat = SrsStatistic::instance();
345-
stat->on_disconnect(secret);
345+
stat->on_disconnect(ctx);
346346
map_ctx_info_.erase(it);
347347

348348
break;

trunk/src/app/srs_app_http_static.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct SrsM3u8CtxInfo
2424
class SrsVodStream : public SrsHttpFileServer, public ISrsFastTimer
2525
{
2626
private:
27-
// The period of validity of the secret
27+
// The period of validity of the ctx
2828
std::map<std::string, SrsM3u8CtxInfo> map_ctx_info_;
2929
public:
3030
SrsVodStream(std::string root_dir);
@@ -34,8 +34,8 @@ class SrsVodStream : public SrsHttpFileServer, public ISrsFastTimer
3434
virtual srs_error_t serve_mp4_stream(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string fullpath, int start, int end);
3535
virtual srs_error_t serve_m3u8_ctx(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string fullpath);
3636
private:
37-
virtual bool ctx_is_exist(std::string secret);
38-
virtual void alive(std::string secret, SrsRequest* req);
37+
virtual bool ctx_is_exist(std::string ctx);
38+
virtual void alive(std::string ctx, SrsRequest* req);
3939
virtual srs_error_t http_hooks_on_play(SrsRequest* req);
4040
virtual void http_hooks_on_stop(SrsRequest* req);
4141
// interface ISrsFastTimer

0 commit comments

Comments
 (0)