Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-11-13 14:38:23 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
62719c2b12259465b4814d3c0d5176d9a13174e5
62719c2b
1 parent
0bc35e09
for bug #200, fix the writev for librtmp, add comments.
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
17 行增加
和
4 行删除
trunk/src/app/srs_app_st_socket.cpp
trunk/src/libs/srs_lib_simple_socket.cpp
trunk/src/app/srs_app_st_socket.cpp
查看文件 @
62719c2
...
...
@@ -84,6 +84,7 @@ int SrsStSocket::read(void* buf, size_t size, ssize_t* nread)
// (a value of 0 means the network connection is closed or end of file is reached).
// Otherwise, a value of -1 is returned and errno is set to indicate the error.
if
(
nb_read
<=
0
)
{
// @see https://github.com/winlinvip/simple-rtmp-server/issues/200
if
(
nb_read
<
0
&&
errno
==
ETIME
)
{
return
ERROR_SOCKET_TIMEOUT
;
}
...
...
@@ -113,6 +114,7 @@ int SrsStSocket::read_fully(void* buf, size_t size, ssize_t* nread)
// (a value less than nbyte means the network connection is closed or end of file is reached)
// Otherwise, a value of -1 is returned and errno is set to indicate the error.
if
(
nb_read
!=
(
ssize_t
)
size
)
{
// @see https://github.com/winlinvip/simple-rtmp-server/issues/200
if
(
nb_read
<
0
&&
errno
==
ETIME
)
{
return
ERROR_SOCKET_TIMEOUT
;
}
...
...
@@ -141,6 +143,7 @@ int SrsStSocket::write(void* buf, size_t size, ssize_t* nwrite)
// On success a non-negative integer equal to nbyte is returned.
// Otherwise, a value of -1 is returned and errno is set to indicate the error.
if
(
nb_write
<=
0
)
{
// @see https://github.com/winlinvip/simple-rtmp-server/issues/200
if
(
nb_write
<
0
&&
errno
==
ETIME
)
{
return
ERROR_SOCKET_TIMEOUT
;
}
...
...
@@ -165,6 +168,7 @@ int SrsStSocket::writev(const iovec *iov, int iov_size, ssize_t* nwrite)
// On success a non-negative integer equal to nbyte is returned.
// Otherwise, a value of -1 is returned and errno is set to indicate the error.
if
(
nb_write
<=
0
)
{
// @see https://github.com/winlinvip/simple-rtmp-server/issues/200
if
(
nb_write
<
0
&&
errno
==
ETIME
)
{
return
ERROR_SOCKET_TIMEOUT
;
}
...
...
trunk/src/libs/srs_lib_simple_socket.cpp
查看文件 @
62719c2
...
...
@@ -143,17 +143,25 @@ int SimpleSocketStream::writev(const iovec *iov, int iov_size, ssize_t* nwrite)
{
int
ret
=
ERROR_SUCCESS
;
*
n
write
=
::
writev
(
fd
,
iov
,
iov_size
);
ssize_t
nb_
write
=
::
writev
(
fd
,
iov
,
iov_size
);
if
(
*
nwrite
<=
0
)
{
if
(
errno
==
ETIME
)
{
if
(
nwrite
)
{
*
nwrite
=
nb_write
;
}
// On success, the readv() function returns the number of bytes read;
// the writev() function returns the number of bytes written. On error, -1 is
// returned, and errno is set appropriately.
if
(
nb_write
<=
0
)
{
// @see https://github.com/winlinvip/simple-rtmp-server/issues/200
if
(
nb_write
<
0
&&
errno
==
ETIME
)
{
return
ERROR_SOCKET_TIMEOUT
;
}
return
ERROR_SOCKET_WRITE
;
}
send_bytes
+=
*
n
write
;
send_bytes
+=
nb_
write
;
return
ret
;
}
...
...
@@ -202,6 +210,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
&&
errno
==
ETIME
)
{
return
ERROR_SOCKET_TIMEOUT
;
}
...
...
请
注册
或
登录
后发表评论