mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +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
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue