different version of last commit

This commit is contained in:
Anthony Minessale 2011-12-10 07:40:40 -06:00
parent 1be966ea01
commit 4b064aa96b
3 changed files with 14 additions and 7 deletions

View File

@ -708,14 +708,10 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
} else if (rsession->state == RS_ESTABLISHED) { } else if (rsession->state == RS_ESTABLISHED) {
/* Process RTMP packet */ /* Process RTMP packet */
switch(rsession->parse_state) { switch(rsession->parse_state) {
switch_status_t rstatus;
case 0: case 0:
// Read the header's first byte // Read the header's first byte
s = 1; s = 1;
rstatus = rsession->profile->io->read(rsession, (unsigned char*)buf, &s); if (rsession->profile->io->read(rsession, (unsigned char*)buf, &s) != SWITCH_STATUS_SUCCESS) {
if (rstatus != SWITCH_STATUS_SUCCESS && !SWITCH_STATUS_IS_BREAK(rstatus)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error\n");
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }

View File

@ -85,7 +85,10 @@ static switch_status_t rtmp_tcp_read(rtmp_session_t *rsession, unsigned char *bu
switch_size_t olen = *len; switch_size_t olen = *len;
#endif #endif
switch_assert(*len > 0 && *len < 1024000); 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 #ifdef RTMP_DEBUG_IO
{ {

View File

@ -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) 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) SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, switch_memory_pool_t *pool)