summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Diebold <flodiebold@gmail.com>2014-05-09 15:51:56 +0200
committerFlorian Diebold <flodiebold@gmail.com>2014-05-09 15:51:56 +0200
commitb40c8e94ac4b3af6a2ea9d6744b5a39d99705575 (patch)
tree91197b76541afe1eb2d911d3b08c24d390beb0e4
parent1e7878ba8ac5268905e6c45ce704ba0d3ba73363 (diff)
downloadcrawl-ref-b40c8e94ac4b3af6a2ea9d6744b5a39d99705575.tar.gz
crawl-ref-b40c8e94ac4b3af6a2ea9d6744b5a39d99705575.zip
Webtiles: Try to deal better with EAGAIN.
This happens a lot on CAO. Allow more attempts, and increase the wait time after the first few.
-rw-r--r--crawl-ref/source/tileweb.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/crawl-ref/source/tileweb.cc b/crawl-ref/source/tileweb.cc
index a2bda4f2dc..8d599884a1 100644
--- a/crawl-ref/source/tileweb.cc
+++ b/crawl-ref/source/tileweb.cc
@@ -199,7 +199,7 @@ void TilesFramework::finish_message()
for (unsigned int i = 0; i < m_dest_addrs.size(); ++i)
{
- int retries = 10;
+ int retries = 30;
ssize_t sent = 0;
while (sent < fragment_size)
{
@@ -218,12 +218,17 @@ void TilesFramework::finish_message()
i--;
break;
}
- else if (errno == ENOBUFS || errno == EAGAIN
- || errno == EWOULDBLOCK || errno == EINTR)
+ else if (errno == ENOBUFS || errno == EWOULDBLOCK
+ || errno == EINTR)
{
// Wait for up to half a second, then try again
usleep(retries <= 5 ? 500 * 1000 : 10 * 1000);
}
+ else if (errno == EAGAIN)
+ {
+ // Wait longer after a few attempts
+ usleep(retries <= 10 ? 500 * 1000 : 5000 * 1000);
+ }
else
die("Socket write error: %s", strerror(errno));
}