From 5168c7c8d6e343d96774d96f30a683c10001229d Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Fri, 6 Apr 2007 18:04:38 -0700
Subject: [PATCH] encode: add more logging to investigate occasional test
 failures

---
 src/allmydata/encode.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/allmydata/encode.py b/src/allmydata/encode.py
index b183a132..968adf9f 100644
--- a/src/allmydata/encode.py
+++ b/src/allmydata/encode.py
@@ -151,7 +151,7 @@ class Encoder(object):
         d.addCallback(lambda res: self.send_all_subshare_hash_trees())
         d.addCallback(lambda res: self.send_all_share_hash_trees())
         d.addCallback(lambda res: self.close_all_shareholders())
-        d.addCallback(lambda res: self.done())
+        d.addCallbacks(lambda res: self.done(), self.err)
         return d
 
     def setup_encryption(self):
@@ -233,7 +233,7 @@ class Encoder(object):
         return sh.callRemote("put_block", segment_num, subshare)
 
     def send_all_subshare_hash_trees(self):
-        log.msg("%s sending hash trees" % self)
+        log.msg("%s sending subshare hash trees" % self)
         dl = []
         for shareid,hashes in enumerate(self.subshare_hashes):
             # hashes is a list of the hashes of all subshares that were sent
@@ -252,6 +252,7 @@ class Encoder(object):
         return sh.callRemote("put_block_hashes", all_hashes)
 
     def send_all_share_hash_trees(self):
+        log.msg("%s sending all share hash trees" % self)
         dl = []
         for h in self.share_root_hashes:
             assert h
@@ -275,6 +276,7 @@ class Encoder(object):
         return sh.callRemote("put_share_hashes", needed_hashes)
 
     def close_all_shareholders(self):
+        log.msg("%s: closing shareholders" % self)
         dl = []
         for shareid in range(self.num_shares):
             dl.append(self.landlords[shareid].callRemote("close"))
@@ -283,3 +285,7 @@ class Encoder(object):
     def done(self):
         log.msg("%s: upload done" % self)
         return self.root_hash
+
+    def err(self, f):
+        log.msg("%s: upload failed: %s" % (self, f))
+        return f
-- 
2.45.2