From 4b064aa96b588d2ec2f6a2af3631da5cc1eb53a4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 10 Dec 2011 07:40:40 -0600 Subject: [PATCH] different version of last commit --- src/mod/endpoints/mod_rtmp/rtmp.c | 6 +----- src/mod/endpoints/mod_rtmp/rtmp_tcp.c | 5 ++++- src/switch_apr.c | 10 +++++++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_rtmp/rtmp.c b/src/mod/endpoints/mod_rtmp/rtmp.c index 3dc9e53f20..701487020e 100644 --- a/src/mod/endpoints/mod_rtmp/rtmp.c +++ b/src/mod/endpoints/mod_rtmp/rtmp.c @@ -708,14 +708,10 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession) } else if (rsession->state == RS_ESTABLISHED) { /* Process RTMP packet */ switch(rsession->parse_state) { - switch_status_t rstatus; - case 0: // Read the header's first byte s = 1; - rstatus = rsession->profile->io->read(rsession, (unsigned char*)buf, &s); - - if (rstatus != SWITCH_STATUS_SUCCESS && !SWITCH_STATUS_IS_BREAK(rstatus)) { + if (rsession->profile->io->read(rsession, (unsigned char*)buf, &s) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error\n"); return SWITCH_STATUS_FALSE; } diff --git a/src/mod/endpoints/mod_rtmp/rtmp_tcp.c b/src/mod/endpoints/mod_rtmp/rtmp_tcp.c index 239a358dcf..7d4bbd5465 100644 --- a/src/mod/endpoints/mod_rtmp/rtmp_tcp.c +++ b/src/mod/endpoints/mod_rtmp/rtmp_tcp.c @@ -85,7 +85,10 @@ static switch_status_t rtmp_tcp_read(rtmp_session_t *rsession, unsigned char *bu switch_size_t olen = *len; #endif switch_assert(*len > 0 && *len < 1024000); - status = switch_socket_recv(io_pvt->socket, (char*)buf, len); + + do { + status = switch_socket_recv(io_pvt->socket, (char*)buf, len); + } while(status != SWITCH_STATUS_SUCCESS && SWITCH_STATUS_IS_BREAK(status)); #ifdef RTMP_DEBUG_IO { diff --git a/src/switch_apr.c b/src/switch_apr.c index d19d3ccd50..7d98ec69ef 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -750,7 +750,15 @@ SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, swit SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len) { - return apr_socket_recv(sock, buf, len); + switch_status_t r; + + r = apr_socket_recv(sock, buf, len); + + if (r == 35 || r == 730035) { + r = SWITCH_STATUS_BREAK; + } + + return r; } SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, switch_memory_pool_t *pool)