1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

substitute all TAB with 4spaces.

This commit is contained in:
winlin 2014-03-18 11:32:58 +08:00
parent e5770b10b1
commit c85dde7f3f
64 changed files with 14105 additions and 14105 deletions

View file

@ -28,9 +28,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SrsSocket::SrsSocket(st_netfd_t client_stfd)
{
stfd = client_stfd;
send_timeout = recv_timeout = ST_UTIME_NO_TIMEOUT;
recv_bytes = send_bytes = 0;
start_time_ms = srs_get_system_time_ms();
send_timeout = recv_timeout = ST_UTIME_NO_TIMEOUT;
recv_bytes = send_bytes = 0;
start_time_ms = srs_get_system_time_ms();
}
SrsSocket::~SrsSocket()
@ -39,59 +39,59 @@ SrsSocket::~SrsSocket()
bool SrsSocket::is_never_timeout(int64_t timeout_us)
{
return timeout_us == (int64_t)ST_UTIME_NO_TIMEOUT;
return timeout_us == (int64_t)ST_UTIME_NO_TIMEOUT;
}
void SrsSocket::set_recv_timeout(int64_t timeout_us)
{
recv_timeout = timeout_us;
recv_timeout = timeout_us;
}
int64_t SrsSocket::get_recv_timeout()
{
return recv_timeout;
return recv_timeout;
}
void SrsSocket::set_send_timeout(int64_t timeout_us)
{
send_timeout = timeout_us;
send_timeout = timeout_us;
}
int64_t SrsSocket::get_send_timeout()
{
return send_timeout;
return send_timeout;
}
int64_t SrsSocket::get_recv_bytes()
{
return recv_bytes;
return recv_bytes;
}
int64_t SrsSocket::get_send_bytes()
{
return send_bytes;
return send_bytes;
}
int SrsSocket::get_recv_kbps()
{
int64_t diff_ms = srs_get_system_time_ms() - start_time_ms;
if (diff_ms <= 0) {
return 0;
}
return recv_bytes * 8 / diff_ms;
int64_t diff_ms = srs_get_system_time_ms() - start_time_ms;
if (diff_ms <= 0) {
return 0;
}
return recv_bytes * 8 / diff_ms;
}
int SrsSocket::get_send_kbps()
{
int64_t diff_ms = srs_get_system_time_ms() - start_time_ms;
if (diff_ms <= 0) {
return 0;
}
return send_bytes * 8 / diff_ms;
int64_t diff_ms = srs_get_system_time_ms() - start_time_ms;
if (diff_ms <= 0) {
return 0;
}
return send_bytes * 8 / diff_ms;
}
int SrsSocket::read(const void* buf, size_t size, ssize_t* nread)
@ -103,10 +103,10 @@ int SrsSocket::read(const 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 (*nread <= 0) {
if (errno == ETIME) {
return ERROR_SOCKET_TIMEOUT;
}
if (errno == ETIME) {
return ERROR_SOCKET_TIMEOUT;
}
if (*nread == 0) {
errno = ECONNRESET;
}
@ -128,10 +128,10 @@ int SrsSocket::read_fully(const 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 less than nbyte means the network connection is closed or end of file is reached)
if (*nread != (ssize_t)size) {
if (errno == ETIME) {
return ERROR_SOCKET_TIMEOUT;
}
if (errno == ETIME) {
return ERROR_SOCKET_TIMEOUT;
}
if (*nread >= 0) {
errno = ECONNRESET;
}
@ -151,10 +151,10 @@ int SrsSocket::write(const void* buf, size_t size, ssize_t* nwrite)
*nwrite = st_write(stfd, (void*)buf, size, send_timeout);
if (*nwrite <= 0) {
if (errno == ETIME) {
return ERROR_SOCKET_TIMEOUT;
}
if (errno == ETIME) {
return ERROR_SOCKET_TIMEOUT;
}
return ERROR_SOCKET_WRITE;
}
@ -170,10 +170,10 @@ int SrsSocket::writev(const iovec *iov, int iov_size, ssize_t* nwrite)
*nwrite = st_writev(stfd, iov, iov_size, send_timeout);
if (*nwrite <= 0) {
if (errno == ETIME) {
return ERROR_SOCKET_TIMEOUT;
}
if (errno == ETIME) {
return ERROR_SOCKET_TIMEOUT;
}
return ERROR_SOCKET_WRITE;
}