} 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;
}
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
{
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)