From 91c7e0f6897827fe1b55535ab5cdf634533078a9 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Mon, 7 Jul 2008 00:17:41 -0700
Subject: [PATCH] mutable: if there are no servers available, return an error,
 rather than hanging forever

---
 src/allmydata/mutable/servermap.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/allmydata/mutable/servermap.py b/src/allmydata/mutable/servermap.py
index 4fbb83f4..6fe605ca 100644
--- a/src/allmydata/mutable/servermap.py
+++ b/src/allmydata/mutable/servermap.py
@@ -461,6 +461,12 @@ class ServermapUpdater:
             self._queries_outstanding.add(peerid)
             self._do_query(ss, peerid, self._storage_index, self._read_size)
 
+        if not peerlist:
+            # there is nobody to ask, so we need to short-circuit the state
+            # machine.
+            d = defer.maybeDeferred(self._check_for_done, None)
+            d.addErrback(self._fatal_error)
+
         # control flow beyond this point: state machine. Receiving responses
         # from queries is the input. We might send out more queries, or we
         # might produce a result.
-- 
2.45.2