diff options
author | David Reid <dreid@apache.org> | 2001-04-04 21:43:04 +0000 |
---|---|---|
committer | David Reid <dreid@apache.org> | 2001-04-04 21:43:04 +0000 |
commit | faa7e8c0864528bdeb50a770068dc1866e664e58 (patch) | |
tree | 33a440586a2a23dd76c826e7650921203ff3f51b /network_io/beos | |
parent | 64d2163cf015a925b0e5c6ddaf92d6a81630f4ce (diff) | |
download | apr-faa7e8c0864528bdeb50a770068dc1866e664e58.tar.gz |
Try to resolve the send blocking issues on BeOS R5.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61456 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io/beos')
-rw-r--r-- | network_io/beos/sendrecv.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/network_io/beos/sendrecv.c b/network_io/beos/sendrecv.c index ec08949d2..74479a810 100644 --- a/network_io/beos/sendrecv.c +++ b/network_io/beos/sendrecv.c @@ -92,6 +92,9 @@ static apr_status_t wait_for_io_or_timeout(apr_socket_t *sock, int for_read) return APR_SUCCESS; } +#define SEND_WAIT APR_USEC_PER_SEC / 10 +#define MAX_SEND_WAIT 2 * APR_USEC_PER_SEC + apr_status_t apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) { ssize_t rv; @@ -101,16 +104,31 @@ apr_status_t apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) } while (rv == -1 && errno == EINTR); if (rv == -1 && errno == EWOULDBLOCK && sock->timeout > 0) { + apr_int32_t snooze = SEND_WAIT; + apr_int32_t zzz = 0; + int loop = 1; +/* apr_status_t arv = wait_for_io_or_timeout(sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; } else { - do { - rv = send(sock->socketdes, buf, (*len), 0); - } while (rv == -1 && errno == EINTR); +*/ + do { + rv = send(sock->socketdes, buf, (*len), 0); + if (rv == -1 && errno == EWOULDBLOCK){ + snooze (snooze_val); + zzz += snooze_val; + snooze_val += (SEND_WAIT * loop++); + /* have we passed our timeout value */ + if (zzz > (sock->timeout * APR_USECS_PER_SEC)) + break; + } + } while (rv == -1 && (errno == EINTR || errno == EWOULDBLOCK)); +/* } +*/ } if (rv == -1) { *len = 0; |