Author: anthm Date: Mon Oct 15 19:49:05 2007 New Revision: 5883 Modified: freeswitch/trunk/src/switch_apr.c Log: fix apr send func not sending all the bytes we asked it to. Modified: freeswitch/trunk/src/switch_apr.c ============================================================================== --- freeswitch/trunk/src/switch_apr.c (original) +++ freeswitch/trunk/src/switch_apr.c Mon Oct 15 19:49:05 2007 @@ -561,7 +561,21 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const char *buf, switch_size_t *len) { - return apr_socket_send(sock, buf, len); + switch_status_t status; + switch_size_t req = *len, wrote = 0, need = 0; + + status = apr_socket_send(sock, buf, len); + if (status == SWITCH_STATUS_SUCCESS) { + wrote = *len; + while (wrote < req && status == SWITCH_STATUS_SUCCESS) { + need = req - wrote; + status = apr_socket_send(sock, buf + wrote, &need); + wrote += need; + } + } + *len = wrote; + return status; + } SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t * sock, switch_sockaddr_t * where, int32_t flags, const char *buf, switch_size_t *len)
participants (1)
-
Freeswitch SVN