mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for bug #229, revert changes of allspace, for srs-librtmp branch build failed. 2.0.34
This commit is contained in:
parent
bb85a0c856
commit
03f72fb1a6
9 changed files with 402 additions and 512 deletions
|
@ -45,22 +45,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
SimpleSocketStream::SimpleSocketStream()
|
||||
{
|
||||
SOCKET_RESET(fd);
|
||||
fd = -1;
|
||||
send_timeout = recv_timeout = ST_UTIME_NO_TIMEOUT;
|
||||
recv_bytes = send_bytes = 0;
|
||||
SOCKET_SETUP();
|
||||
}
|
||||
|
||||
SimpleSocketStream::~SimpleSocketStream()
|
||||
{
|
||||
SOCKET_CLOSE(fd);
|
||||
SOCKET_CLEANUP();
|
||||
if (fd != -1) {
|
||||
::close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int SimpleSocketStream::create_socket()
|
||||
{
|
||||
fd = ::socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (!SOCKET_VALID(fd)) {
|
||||
if((fd = ::socket(AF_INET, SOCK_STREAM, 0)) < 0){
|
||||
return ERROR_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
|
@ -95,12 +95,12 @@ int SimpleSocketStream::read(void* buf, size_t size, ssize_t* nread)
|
|||
// On success a non-negative integer indicating the number of bytes actually read is returned
|
||||
// (a value of 0 means the network connection is closed or end of file is reached).
|
||||
if (nb_read <= 0) {
|
||||
if (nb_read < 0 && SOCKET_ERRNO() == SOCKET_ETIME) {
|
||||
if (nb_read < 0 && errno == ETIME) {
|
||||
return ERROR_SOCKET_TIMEOUT;
|
||||
}
|
||||
|
||||
if (nb_read == 0) {
|
||||
errno = SOCKET_ECONNRESET;
|
||||
errno = ECONNRESET;
|
||||
}
|
||||
|
||||
return ERROR_SOCKET_READ;
|
||||
|
@ -158,7 +158,7 @@ int SimpleSocketStream::writev(const iovec *iov, int iov_size, ssize_t* nwrite)
|
|||
// returned, and errno is set appropriately.
|
||||
if (nb_write <= 0) {
|
||||
// @see https://github.com/winlinvip/simple-rtmp-server/issues/200
|
||||
if (nb_write < 0 && SOCKET_ERRNO() == SOCKET_ETIME) {
|
||||
if (nb_write < 0 && errno == ETIME) {
|
||||
return ERROR_SOCKET_TIMEOUT;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ int SimpleSocketStream::write(void* buf, size_t size, ssize_t* nwrite)
|
|||
|
||||
if (nb_write <= 0) {
|
||||
// @see https://github.com/winlinvip/simple-rtmp-server/issues/200
|
||||
if (nb_write < 0 && SOCKET_ERRNO() == SOCKET_ETIME) {
|
||||
if (nb_write < 0 && errno == ETIME) {
|
||||
return ERROR_SOCKET_TIMEOUT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue