[Freeswitch-svn] [commit] r10540 - in freeswitch/trunk/src: . include
FreeSWITCH SVN
anthm at freeswitch.org
Wed Nov 26 07:22:28 PST 2008
Author: anthm
Date: Wed Nov 26 10:22:26 2008
New Revision: 10540
Log:
update
Modified:
freeswitch/trunk/src/include/switch_apr.h
freeswitch/trunk/src/switch_apr.c
freeswitch/trunk/src/switch_rtp.c
Modified: freeswitch/trunk/src/include/switch_apr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_apr.h (original)
+++ freeswitch/trunk/src/include/switch_apr.h Wed Nov 26 10:22:26 2008
@@ -1123,6 +1123,7 @@
*/
SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len);
+SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int *atmark);
/**
* Read data from a network.
Modified: freeswitch/trunk/src/switch_apr.c
==============================================================================
--- freeswitch/trunk/src/switch_apr.c (original)
+++ freeswitch/trunk/src/switch_apr.c Wed Nov 26 10:22:26 2008
@@ -754,6 +754,11 @@
return sa->family;
}
+SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int *atmark)
+{
+ return apr_socket_atmark(sock, atmark);
+}
+
SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len)
{
apr_status_t r;
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Wed Nov 26 10:22:26 2008
@@ -1269,32 +1269,35 @@
switch_size_t bytes;
switch_status_t status;
- if (!switch_rtp_ready(rtp_session)) {
+ if (!switch_rtp_ready(rtp_session) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
return;
}
-
+
READ_INC(rtp_session);
- if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK)) {
- was_blocking = 1;
- switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
- switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, TRUE);
- }
+ if (switch_rtp_ready(rtp_session)) {
+ if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK)) {
+ was_blocking = 1;
+ switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
+ switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, TRUE);
+ }
- do {
- bytes = sizeof(rtp_msg_t);
- status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes);
- } while(bytes);
-
- if (was_blocking) {
- switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
- switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, FALSE);
+ do {
+ if (switch_rtp_ready(rtp_session)) {
+ bytes = sizeof(rtp_msg_t);
+ status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes);
+ } else {
+ break;
+ }
+ } while(bytes > 0);
+
+ if (was_blocking && switch_rtp_ready(rtp_session)) {
+ switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
+ switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, FALSE);
+ }
}
READ_DEC(rtp_session);
-
-
-
}
#define return_cng_frame() do_cng = 1; goto timer_check
More information about the Freeswitch-svn
mailing list