mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-12 20:27:19 +00:00
wait there's more
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5884 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
5baa5facf0
commit
2b9a0327d0
@ -561,18 +561,24 @@ SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t * sock, sw
|
|||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const char *buf, switch_size_t *len)
|
SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const char *buf, switch_size_t *len)
|
||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
switch_size_t req = *len, wrote = 0, need = 0;
|
switch_size_t req = *len, wrote = 0, need = *len;
|
||||||
|
int to_count = 0;
|
||||||
|
|
||||||
status = apr_socket_send(sock, buf, len);
|
while ((wrote < req && status == SWITCH_STATUS_SUCCESS) || (need == 0 && status == SWITCH_STATUS_BREAK)) {
|
||||||
if (status == SWITCH_STATUS_SUCCESS) {
|
need = req - wrote;
|
||||||
wrote = *len;
|
if ((status = apr_socket_send(sock, buf + wrote, &need)) == SWITCH_STATUS_BREAK) {
|
||||||
while (wrote < req && status == SWITCH_STATUS_SUCCESS) {
|
if (++to_count > 10000) {
|
||||||
need = req - wrote;
|
status = SWITCH_STATUS_FALSE;
|
||||||
status = apr_socket_send(sock, buf + wrote, &need);
|
break;
|
||||||
wrote += need;
|
}
|
||||||
|
switch_yield(1000);
|
||||||
|
} else {
|
||||||
|
to_count = 0;
|
||||||
}
|
}
|
||||||
|
wrote += need;
|
||||||
}
|
}
|
||||||
|
|
||||||
*len = wrote;
|
*len = wrote;
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user