diff --git a/src/wormhole/servers/relay_server.py b/src/wormhole/servers/relay_server.py index abea91c..862da9d 100644 --- a/src/wormhole/servers/relay_server.py +++ b/src/wormhole/servers/relay_server.py @@ -318,9 +318,9 @@ class Channel: return (started, "pruney", total_time, None) # ok, both sides closed. figure out the mood - A_mood = A_deallocs[0]["body"] - B_mood = B_deallocs[0]["body"] - mood = "errory" + A_mood = A_deallocs[0]["body"] # maybe None + B_mood = B_deallocs[0]["body"] # maybe None + mood = "quiet" if A_mood == u"happy" and B_mood == u"happy": mood = "happy" if A_mood == u"lonely" or B_mood == u"lonely": diff --git a/src/wormhole/test/test_server.py b/src/wormhole/test/test_server.py index fe8a6b2..59e42c2 100644 --- a/src/wormhole/test/test_server.py +++ b/src/wormhole/test/test_server.py @@ -413,3 +413,13 @@ class Summary(unittest.TestCase): (1, "scary", 40, 9)) self.failUnlessEqual(c._summarize(make_moods("scary", "errory"), 41), (1, "scary", 40, 9)) + + # older clients don't send a mood + self.failUnlessEqual(c._summarize(make_moods(None, None), 41), + (1, "quiet", 40, 9)) + self.failUnlessEqual(c._summarize(make_moods(None, "happy"), 41), + (1, "quiet", 40, 9)) + self.failUnlessEqual(c._summarize(make_moods(None, "happy"), 41), + (1, "quiet", 40, 9)) + self.failUnlessEqual(c._summarize(make_moods(None, "scary"), 41), + (1, "scary", 40, 9))