winlin

workaround for #511, the fly stfd in close. 2.0.211

@@ -340,6 +340,7 @@ Remark: @@ -340,6 +340,7 @@ Remark:
340 340
341 ## History 341 ## History
342 342
  343 +* v2.0, 2016-09-01, workaround [bug #511] the fly stfd in close. 2.0.211
343 * v2.0, 2016-08-30, comment the pcr. 344 * v2.0, 2016-08-30, comment the pcr.
344 * v2.0, 2016-08-18, fix [srs-librtmp#4](https://github.com/ossrs/srs-librtmp/issues/4) filter frame. 345 * v2.0, 2016-08-18, fix [srs-librtmp#4](https://github.com/ossrs/srs-librtmp/issues/4) filter frame.
345 * v2.0, 2016-08-10, fix socket timeout for librtmp. 346 * v2.0, 2016-08-10, fix socket timeout for librtmp.
@@ -1231,6 +1232,7 @@ Winlin @@ -1231,6 +1232,7 @@ Winlin
1231 [bug #546]: https://github.com/ossrs/srs/issues/546 1232 [bug #546]: https://github.com/ossrs/srs/issues/546
1232 [bug #418]: https://github.com/ossrs/srs/issues/418 1233 [bug #418]: https://github.com/ossrs/srs/issues/418
1233 [bug #509]: https://github.com/ossrs/srs/issues/509 1234 [bug #509]: https://github.com/ossrs/srs/issues/509
  1235 +[bug #511]: https://github.com/ossrs/srs/issues/511
1234 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx 1236 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
1235 1237
1236 [exo #828]: https://github.com/google/ExoPlayer/pull/828 1238 [exo #828]: https://github.com/google/ExoPlayer/pull/828
@@ -225,8 +225,11 @@ int SrsRtmpConn::on_reload_vhost_removed(string vhost) @@ -225,8 +225,11 @@ int SrsRtmpConn::on_reload_vhost_removed(string vhost)
225 // if the vhost connected is removed, disconnect the client. 225 // if the vhost connected is removed, disconnect the client.
226 srs_trace("vhost %s removed/disabled, close client url=%s", 226 srs_trace("vhost %s removed/disabled, close client url=%s",
227 vhost.c_str(), req->get_stream_url().c_str()); 227 vhost.c_str(), req->get_stream_url().c_str());
228 -  
229 - srs_close_stfd(stfd); 228 +
  229 + // should never close the fd in another thread,
  230 + // one fd should managed by one thread, we should use interrupt instead.
  231 + // so we just ignore the vhost enabled event.
  232 + //srs_close_stfd(stfd);
230 233
231 return ret; 234 return ret;
232 } 235 }
@@ -234,13 +234,9 @@ int srs_st_init() @@ -234,13 +234,9 @@ int srs_st_init()
234 void srs_close_stfd(st_netfd_t& stfd) 234 void srs_close_stfd(st_netfd_t& stfd)
235 { 235 {
236 if (stfd) { 236 if (stfd) {
237 - int fd = st_netfd_fileno(stfd);  
238 - st_netfd_close(stfd);  
239 - stfd = NULL;  
240 -  
241 - // st does not close it sometimes,  
242 - // close it manually.  
243 - close(fd); 237 + // we must ensure the close is ok.
  238 + int err = st_netfd_close(stfd);
  239 + srs_assert(err != -1);
244 } 240 }
245 } 241 }
246 242
@@ -75,6 +75,7 @@ public: @@ -75,6 +75,7 @@ public:
75 extern int srs_st_init(); 75 extern int srs_st_init();
76 76
77 // close the netfd, and close the underlayer fd. 77 // close the netfd, and close the underlayer fd.
  78 +// @remark when close, user must ensure io completed.
78 extern void srs_close_stfd(st_netfd_t& stfd); 79 extern void srs_close_stfd(st_netfd_t& stfd);
79 80
80 #endif 81 #endif
@@ -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 210 34 +#define VERSION_REVISION 211
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>