Skip to content

Commit

Permalink
for #752, release the io then free it for kbps. 2.0.232
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jan 22, 2017
1 parent 80dfe60 commit 6706bda
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ Remark:

## History

* v2.0, 2017-01-22, for [#752][bug #752] release the io then free it for kbps. 2.0.232
* v2.0, 2017-01-18, fix [#750][bug #750] use specific error code for dns resolve. 2.0.231
* <strong>v2.0, 2017-01-18, [2.0 beta4(2.0.230)][r2.0b4] released. 86334 lines.</strong>
* v2.0, 2017-01-18, fix [#749][bug #749], timestamp overflow for ATC. 2.0.230
Expand Down Expand Up @@ -1283,6 +1284,7 @@ Winlin
[bug #740]: https://github.com/ossrs/srs/issues/740
[bug #749]: https://github.com/ossrs/srs/issues/749
[bug #750]: https://github.com/ossrs/srs/issues/750
[bug #752]: https://github.com/ossrs/srs/issues/752
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx

[exo #828]: https://github.com/google/ExoPlayer/pull/828
Expand Down
6 changes: 4 additions & 2 deletions trunk/src/app/srs_app_edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ void SrsEdgeIngester::stop()

close_underlayer_socket();

kbps->set_io(NULL, NULL);
srs_freep(client);
srs_freep(io);
kbps->set_io(NULL, NULL);

// notice to unpublish.
_source->on_unpublish();
Expand Down Expand Up @@ -376,6 +376,7 @@ int SrsEdgeIngester::connect_server(string& ep_server, string& ep_port)
return ret;
}

kbps->set_io(NULL, NULL);
srs_freep(client);
srs_freep(io);

Expand Down Expand Up @@ -478,9 +479,9 @@ void SrsEdgeForwarder::stop()

queue->clear();

kbps->set_io(NULL, NULL);
srs_freep(client);
srs_freep(io);
kbps->set_io(NULL, NULL);
}

#define SYS_MAX_EDGE_SEND_MSGS 128
Expand Down Expand Up @@ -626,6 +627,7 @@ int SrsEdgeForwarder::connect_server(string& ep_server, string& ep_port)
return ret;
}

kbps->set_io(NULL, NULL);
srs_freep(client);
srs_freep(io);

Expand Down
3 changes: 2 additions & 1 deletion trunk/src/app/srs_app_forward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ void SrsForwarder::on_unpublish()

close_underlayer_socket();

kbps->set_io(NULL, NULL);
srs_freep(client);
srs_freep(io);
kbps->set_io(NULL, NULL);
}

int SrsForwarder::on_meta_data(SrsSharedPtrMessage* shared_metadata)
Expand Down Expand Up @@ -313,6 +313,7 @@ int SrsForwarder::connect_server(string& ep_server, string& ep_port)
return ret;
}

kbps->set_io(NULL, NULL);
srs_freep(client);
srs_freep(io);

Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 231
#define VERSION_REVISION 232

// generated by configure, only macros.
#include <srs_auto_headers.hpp>
Expand Down
19 changes: 10 additions & 9 deletions trunk/src/protocol/srs_protocol_kbps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class IKbpsDelta
* SrsKbps* kbps = ...;
* kbps->set_io(in, out);
* // both kbps->get_recv_bytes() and kbps->get_send_bytes() are available.
* // we can use the kbps as the data source of another kbps:
* // we can use the kbps as the data source of another kbps:
* SrsKbps* user = ...;
* user->set_io(kbps, kbps);
* the server never know how many bytes already send/recv, for the connection maybe closed.
Expand All @@ -176,14 +176,15 @@ class SrsKbps : public virtual ISrsProtocolStatistic, public virtual IKbpsDelta
virtual ~SrsKbps();
public:
/**
* set io to start new session.
* set the underlayer reader/writer,
* if the io destroied, for instance, the forwarder reconnect,
* user must set the io of SrsKbps to NULL to continue to use the kbps object.
* @param in the input stream statistic. can be NULL.
* @param out the output stream statistic. can be NULL.
* @remark if in/out is NULL, use the cached data for kbps.
*/
* set io to start new session.
* set the underlayer reader/writer,
* if the io destroied, for instance, the forwarder reconnect,
* user must set the io of SrsKbps to NULL to continue to use the kbps object.
* @param in the input stream statistic. can be NULL.
* @param out the output stream statistic. can be NULL.
* @remark if in/out is NULL, use the cached data for kbps.
* @remark User must set_io(NULL, NULL) then free the in and out.
*/
virtual void set_io(ISrsProtocolStatistic* in, ISrsProtocolStatistic* out);
public:
/**
Expand Down

0 comments on commit 6706bda

Please sign in to comment.