mirror of
https://github.com/ossrs/srs.git
synced 2025-02-12 11:21:52 +00:00
Fix #786, simply don't reuse object. 3.0.20
This commit is contained in:
parent
7680ac04ad
commit
308c6fee18
9 changed files with 38 additions and 19 deletions
|
@ -186,6 +186,7 @@ Please select your language:
|
|||
|
||||
### V3 changes
|
||||
|
||||
* v3.0, 2017-03-02, Fix [#786][bug #786], simply don't reuse object. 3.0.20
|
||||
* v3.0, 2017-03-01, For [#110][bug #110], refine thread object. 3.0.19
|
||||
* v3.0, 2017-02-12, Fix [#301][bug #301], User must config the codec in right way for HLS. 3.0.18
|
||||
* v3.0, 2017-02-07, fix [#738][bug #738] support DVR general mp4. 3.0.17
|
||||
|
@ -1384,6 +1385,7 @@ Winlin
|
|||
[bug #735]: https://github.com/ossrs/srs/issues/735
|
||||
[bug #742]: https://github.com/ossrs/srs/issues/742
|
||||
[bug #738]: https://github.com/ossrs/srs/issues/738
|
||||
[bug #786]: https://github.com/ossrs/srs/issues/786
|
||||
[bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx
|
||||
|
||||
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
||||
|
|
|
@ -48,7 +48,7 @@ SrsConnection::SrsConnection(IConnectionManager* cm, st_netfd_t c, string cip)
|
|||
expired = false;
|
||||
create_time = srs_get_system_time_ms();
|
||||
|
||||
skt = new SrsStSocket(c);
|
||||
skt = new SrsStSocket();
|
||||
kbps = new SrsKbps();
|
||||
kbps->set_io(skt, skt);
|
||||
|
||||
|
@ -105,6 +105,12 @@ void SrsConnection::dispose()
|
|||
|
||||
int SrsConnection::start()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if ((ret = skt->initialize(stfd)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return pthread->start();
|
||||
}
|
||||
|
||||
|
|
|
@ -1342,12 +1342,9 @@ int SrsHttpApi::do_cycle()
|
|||
return ret;
|
||||
}
|
||||
|
||||
// underlayer socket
|
||||
SrsStSocket skt(stfd);
|
||||
|
||||
// set the recv timeout, for some clients never disconnect the connection.
|
||||
// @see https://github.com/ossrs/srs/issues/398
|
||||
skt.set_recv_timeout(SRS_HTTP_RECV_TMMS);
|
||||
skt->set_recv_timeout(SRS_HTTP_RECV_TMMS);
|
||||
|
||||
// initialize the cors, which will proxy to mux.
|
||||
bool crossdomain_enabled = _srs_config->get_http_api_crossdomain();
|
||||
|
@ -1360,7 +1357,7 @@ int SrsHttpApi::do_cycle()
|
|||
ISrsHttpMessage* req = NULL;
|
||||
|
||||
// get a http message
|
||||
if ((ret = parser->parse_message(&skt, this, &req)) != ERROR_SUCCESS) {
|
||||
if ((ret = parser->parse_message(skt, this, &req)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1371,7 +1368,7 @@ int SrsHttpApi::do_cycle()
|
|||
SrsAutoFree(ISrsHttpMessage, req);
|
||||
|
||||
// ok, handle http request.
|
||||
SrsHttpResponseWriter writer(&skt);
|
||||
SrsHttpResponseWriter writer(skt);
|
||||
if ((ret = process_request(&writer, req)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -302,7 +302,6 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* svr, st_netfd_t c, string cip)
|
|||
{
|
||||
server = svr;
|
||||
|
||||
skt = new SrsStSocket(c);
|
||||
rtmp = new SrsRtmpServer(skt);
|
||||
refer = new SrsRefer();
|
||||
bandwidth = new SrsBandwidth();
|
||||
|
@ -328,7 +327,6 @@ SrsRtmpConn::~SrsRtmpConn()
|
|||
|
||||
srs_freep(info);
|
||||
srs_freep(rtmp);
|
||||
srs_freep(skt);
|
||||
srs_freep(refer);
|
||||
srs_freep(bandwidth);
|
||||
srs_freep(security);
|
||||
|
|
|
@ -139,7 +139,6 @@ class SrsRtmpConn : public virtual SrsConnection, public virtual ISrsReloadHandl
|
|||
friend class SrsPublishRecvThread;
|
||||
private:
|
||||
SrsServer* server;
|
||||
SrsStSocket* skt;
|
||||
SrsRtmpServer* rtmp;
|
||||
SrsRefer* refer;
|
||||
SrsBandwidth* bandwidth;
|
||||
|
|
|
@ -193,7 +193,7 @@ SrsRtspConn::SrsRtspConn(SrsRtspCaster* c, st_netfd_t fd, std::string o)
|
|||
|
||||
caster = c;
|
||||
stfd = fd;
|
||||
skt = new SrsStSocket(fd);
|
||||
skt = new SrsStSocket();
|
||||
rtsp = new SrsRtspStack(skt);
|
||||
trd = new SrsOneCycleThread("rtsp", this);
|
||||
|
||||
|
@ -232,6 +232,11 @@ SrsRtspConn::~SrsRtspConn()
|
|||
|
||||
int SrsRtspConn::serve()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
if ((ret = skt->initialize(stfd)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return trd->start();
|
||||
}
|
||||
|
||||
|
|
|
@ -208,9 +208,9 @@ namespace internal
|
|||
}
|
||||
}
|
||||
|
||||
SrsStSocket::SrsStSocket(st_netfd_t client_stfd)
|
||||
SrsStSocket::SrsStSocket()
|
||||
{
|
||||
stfd = client_stfd;
|
||||
stfd = NULL;
|
||||
stm = rtm = SRS_CONSTS_NO_TMMS;
|
||||
rbytes = sbytes = 0;
|
||||
}
|
||||
|
@ -219,6 +219,12 @@ SrsStSocket::~SrsStSocket()
|
|||
{
|
||||
}
|
||||
|
||||
int SrsStSocket::initialize(st_netfd_t fd)
|
||||
{
|
||||
stfd = fd;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool SrsStSocket::is_never_timeout(int64_t tm)
|
||||
{
|
||||
return tm == SRS_CONSTS_NO_TMMS;
|
||||
|
@ -390,8 +396,8 @@ int SrsStSocket::writev(const iovec *iov, int iov_size, ssize_t* nwrite)
|
|||
|
||||
SrsTcpClient::SrsTcpClient(string h, int p, int64_t tm)
|
||||
{
|
||||
io = NULL;
|
||||
stfd = NULL;
|
||||
io = new SrsStSocket();
|
||||
|
||||
host = h;
|
||||
port = p;
|
||||
|
@ -401,6 +407,8 @@ SrsTcpClient::SrsTcpClient(string h, int p, int64_t tm)
|
|||
SrsTcpClient::~SrsTcpClient()
|
||||
{
|
||||
close();
|
||||
|
||||
srs_freep(io);
|
||||
}
|
||||
|
||||
int SrsTcpClient::connect()
|
||||
|
@ -415,8 +423,9 @@ int SrsTcpClient::connect()
|
|||
return ret;
|
||||
}
|
||||
|
||||
srs_assert(io == NULL);
|
||||
io = new SrsStSocket(stfd);
|
||||
if ((ret = io->initialize(stfd)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -428,7 +437,6 @@ void SrsTcpClient::close()
|
|||
return;
|
||||
}
|
||||
|
||||
srs_freep(io);
|
||||
srs_close_stfd(stfd);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,8 +182,11 @@ private:
|
|||
// The underlayer st fd.
|
||||
st_netfd_t stfd;
|
||||
public:
|
||||
SrsStSocket(st_netfd_t client_stfd);
|
||||
SrsStSocket();
|
||||
virtual ~SrsStSocket();
|
||||
public:
|
||||
// Initialize the socket with stfd, user must manage it.
|
||||
virtual int initialize(st_netfd_t fd);
|
||||
public:
|
||||
virtual bool is_never_timeout(int64_t tm);
|
||||
virtual void set_recv_timeout(int64_t tm);
|
||||
|
@ -240,6 +243,7 @@ public:
|
|||
* @remark We will close the exists connection before do connect.
|
||||
*/
|
||||
virtual int connect();
|
||||
private:
|
||||
/**
|
||||
* Close the connection to server.
|
||||
* @remark User should never use the client when close it.
|
||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
// current release version
|
||||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 19
|
||||
#define VERSION_REVISION 20
|
||||
|
||||
// generated by configure, only macros.
|
||||
#include <srs_auto_headers.hpp>
|
||||
|
|
Loading…
Reference in a new issue