From 147670fd89a04bad564faa0d1cdbf2803ea90b93 Mon Sep 17 00:00:00 2001
From: Kevan Carstensen <kevan@isnotajoke.com>
Date: Tue, 27 Dec 2011 21:50:18 -0800
Subject: [PATCH] mutable publish: fix not-enough-shares detection. Refs #1628.

This should match the "fix-1628.darcs.2.patch" attachment on that ticket.
---
 src/allmydata/mutable/publish.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/allmydata/mutable/publish.py b/src/allmydata/mutable/publish.py
index 1e2de76d..e8f2ebb4 100644
--- a/src/allmydata/mutable/publish.py
+++ b/src/allmydata/mutable/publish.py
@@ -623,10 +623,9 @@ class Publish:
         # Can we still successfully publish this file?
         # TODO: Keep track of outstanding queries before aborting the
         #       process.
-        all_writers = []
-        for shnum, writers in self.writers.iteritems():
-            all_writers.extend(writers)
-        if len(all_writers) < self.required_shares or self.surprised:
+        all_shnums = filter(lambda sh: len(self.writers[sh]) > 0,
+                            self.writers.iterkeys())
+        if len(all_shnums) < self.required_shares or self.surprised:
             return self._failure()
 
         # Figure out what we need to do next. Each of these needs to
-- 
2.45.2