winlin

refine code, add comments for stat on_disconnect.

@@ -206,6 +206,7 @@ int SrsRtmpConn::do_cycle() @@ -206,6 +206,7 @@ int SrsRtmpConn::do_cycle()
206 } 206 }
207 207
208 ret = service_cycle(); 208 ret = service_cycle();
  209 +
209 http_hooks_on_close(); 210 http_hooks_on_close();
210 SrsStatistic* stat = SrsStatistic::instance(); 211 SrsStatistic* stat = SrsStatistic::instance();
211 stat->on_disconnect(_srs_context->get_id()); 212 stat->on_disconnect(_srs_context->get_id());
@@ -154,14 +154,17 @@ public: @@ -154,14 +154,17 @@ public:
154 virtual void on_stream_close(SrsRequest* req); 154 virtual void on_stream_close(SrsRequest* req);
155 public: 155 public:
156 /** 156 /**
157 - * when got a client to publish/play stream,  
158 - * @param id, the client srs id.  
159 - * @param req, the client request object.  
160 - */ 157 + * when got a client to publish/play stream,
  158 + * @param id, the client srs id.
  159 + * @param req, the client request object.
  160 + */
161 virtual int on_client(int id, SrsRequest* req); 161 virtual int on_client(int id, SrsRequest* req);
162 /** 162 /**
163 - * client disconnect  
164 - */ 163 + * client disconnect
  164 + * @remark the on_disconnect always call, while the on_client is call when
  165 + * only got the request object, so the client specified by id maybe not
  166 + * exists in stat.
  167 + */
165 virtual void on_disconnect(int id); 168 virtual void on_disconnect(int id);
166 /** 169 /**
167 * sample the kbps, add delta bytes of conn. 170 * sample the kbps, add delta bytes of conn.