winlin

for #752, release the io then free it for kbps. 2.0.232

@@ -346,6 +346,7 @@ Remark: @@ -346,6 +346,7 @@ Remark:
346 346
347 ## History 347 ## History
348 348
  349 +* v2.0, 2017-01-22, for [#752][bug #752] release the io then free it for kbps. 2.0.232
349 * v2.0, 2017-01-18, fix [#750][bug #750] use specific error code for dns resolve. 2.0.231 350 * v2.0, 2017-01-18, fix [#750][bug #750] use specific error code for dns resolve. 2.0.231
350 * <strong>v2.0, 2017-01-18, [2.0 beta4(2.0.230)][r2.0b4] released. 86334 lines.</strong> 351 * <strong>v2.0, 2017-01-18, [2.0 beta4(2.0.230)][r2.0b4] released. 86334 lines.</strong>
351 * v2.0, 2017-01-18, fix [#749][bug #749], timestamp overflow for ATC. 2.0.230 352 * v2.0, 2017-01-18, fix [#749][bug #749], timestamp overflow for ATC. 2.0.230
@@ -1283,6 +1284,7 @@ Winlin @@ -1283,6 +1284,7 @@ Winlin
1283 [bug #740]: https://github.com/ossrs/srs/issues/740 1284 [bug #740]: https://github.com/ossrs/srs/issues/740
1284 [bug #749]: https://github.com/ossrs/srs/issues/749 1285 [bug #749]: https://github.com/ossrs/srs/issues/749
1285 [bug #750]: https://github.com/ossrs/srs/issues/750 1286 [bug #750]: https://github.com/ossrs/srs/issues/750
  1287 +[bug #752]: https://github.com/ossrs/srs/issues/752
1286 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx 1288 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
1287 1289
1288 [exo #828]: https://github.com/google/ExoPlayer/pull/828 1290 [exo #828]: https://github.com/google/ExoPlayer/pull/828
@@ -110,9 +110,9 @@ void SrsEdgeIngester::stop() @@ -110,9 +110,9 @@ void SrsEdgeIngester::stop()
110 110
111 close_underlayer_socket(); 111 close_underlayer_socket();
112 112
  113 + kbps->set_io(NULL, NULL);
113 srs_freep(client); 114 srs_freep(client);
114 srs_freep(io); 115 srs_freep(io);
115 - kbps->set_io(NULL, NULL);  
116 116
117 // notice to unpublish. 117 // notice to unpublish.
118 _source->on_unpublish(); 118 _source->on_unpublish();
@@ -376,6 +376,7 @@ int SrsEdgeIngester::connect_server(string& ep_server, string& ep_port) @@ -376,6 +376,7 @@ int SrsEdgeIngester::connect_server(string& ep_server, string& ep_port)
376 return ret; 376 return ret;
377 } 377 }
378 378
  379 + kbps->set_io(NULL, NULL);
379 srs_freep(client); 380 srs_freep(client);
380 srs_freep(io); 381 srs_freep(io);
381 382
@@ -478,9 +479,9 @@ void SrsEdgeForwarder::stop() @@ -478,9 +479,9 @@ void SrsEdgeForwarder::stop()
478 479
479 queue->clear(); 480 queue->clear();
480 481
  482 + kbps->set_io(NULL, NULL);
481 srs_freep(client); 483 srs_freep(client);
482 srs_freep(io); 484 srs_freep(io);
483 - kbps->set_io(NULL, NULL);  
484 } 485 }
485 486
486 #define SYS_MAX_EDGE_SEND_MSGS 128 487 #define SYS_MAX_EDGE_SEND_MSGS 128
@@ -626,6 +627,7 @@ int SrsEdgeForwarder::connect_server(string& ep_server, string& ep_port) @@ -626,6 +627,7 @@ int SrsEdgeForwarder::connect_server(string& ep_server, string& ep_port)
626 return ret; 627 return ret;
627 } 628 }
628 629
  630 + kbps->set_io(NULL, NULL);
629 srs_freep(client); 631 srs_freep(client);
630 srs_freep(io); 632 srs_freep(io);
631 633
@@ -150,9 +150,9 @@ void SrsForwarder::on_unpublish() @@ -150,9 +150,9 @@ void SrsForwarder::on_unpublish()
150 150
151 close_underlayer_socket(); 151 close_underlayer_socket();
152 152
  153 + kbps->set_io(NULL, NULL);
153 srs_freep(client); 154 srs_freep(client);
154 srs_freep(io); 155 srs_freep(io);
155 - kbps->set_io(NULL, NULL);  
156 } 156 }
157 157
158 int SrsForwarder::on_meta_data(SrsSharedPtrMessage* shared_metadata) 158 int SrsForwarder::on_meta_data(SrsSharedPtrMessage* shared_metadata)
@@ -313,6 +313,7 @@ int SrsForwarder::connect_server(string& ep_server, string& ep_port) @@ -313,6 +313,7 @@ int SrsForwarder::connect_server(string& ep_server, string& ep_port)
313 return ret; 313 return ret;
314 } 314 }
315 315
  316 + kbps->set_io(NULL, NULL);
316 srs_freep(client); 317 srs_freep(client);
317 srs_freep(io); 318 srs_freep(io);
318 319
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 231 34 +#define VERSION_REVISION 232
35 35
36 // generated by configure, only macros. 36 // generated by configure, only macros.
37 #include <srs_auto_headers.hpp> 37 #include <srs_auto_headers.hpp>
@@ -161,7 +161,7 @@ public: @@ -161,7 +161,7 @@ public:
161 * SrsKbps* kbps = ...; 161 * SrsKbps* kbps = ...;
162 * kbps->set_io(in, out); 162 * kbps->set_io(in, out);
163 * // both kbps->get_recv_bytes() and kbps->get_send_bytes() are available. 163 * // both kbps->get_recv_bytes() and kbps->get_send_bytes() are available.
164 -* // we can use the kbps as the data source of another kbps: 164 + * // we can use the kbps as the data source of another kbps:
165 * SrsKbps* user = ...; 165 * SrsKbps* user = ...;
166 * user->set_io(kbps, kbps); 166 * user->set_io(kbps, kbps);
167 * the server never know how many bytes already send/recv, for the connection maybe closed. 167 * the server never know how many bytes already send/recv, for the connection maybe closed.
@@ -176,14 +176,15 @@ public: @@ -176,14 +176,15 @@ public:
176 virtual ~SrsKbps(); 176 virtual ~SrsKbps();
177 public: 177 public:
178 /** 178 /**
179 - * set io to start new session.  
180 - * set the underlayer reader/writer,  
181 - * if the io destroied, for instance, the forwarder reconnect,  
182 - * user must set the io of SrsKbps to NULL to continue to use the kbps object.  
183 - * @param in the input stream statistic. can be NULL.  
184 - * @param out the output stream statistic. can be NULL.  
185 - * @remark if in/out is NULL, use the cached data for kbps.  
186 - */ 179 + * set io to start new session.
  180 + * set the underlayer reader/writer,
  181 + * if the io destroied, for instance, the forwarder reconnect,
  182 + * user must set the io of SrsKbps to NULL to continue to use the kbps object.
  183 + * @param in the input stream statistic. can be NULL.
  184 + * @param out the output stream statistic. can be NULL.
  185 + * @remark if in/out is NULL, use the cached data for kbps.
  186 + * @remark User must set_io(NULL, NULL) then free the in and out.
  187 + */
187 virtual void set_io(ISrsProtocolStatistic* in, ISrsProtocolStatistic* out); 188 virtual void set_io(ISrsProtocolStatistic* in, ISrsProtocolStatistic* out);
188 public: 189 public:
189 /** 190 /**