git: 9front

Download patch

ref: 35e142ebb4213eefe63d1f650493504c72508c8e
parent: 19d29cd521ba47708a239ceb572894d3d6882ac4
author: aiju <devnull@localhost>
date: Sat Feb 25 20:13:13 EST 2017

hgwebfs: keep trying as long as we get needkey response

--- a/sys/lib/python/hgext/hgwebfs.py
+++ b/sys/lib/python/hgext/hgwebfs.py
@@ -6,20 +6,22 @@
 
 class Webconn:
 	def __init__(self, mnt, req):
-		try:
-			self.open(mnt, req)
-		except IOError, e:
+		loop = True
+		while loop:
+			loop = False
 			try:
-				errstr = e.strerror
-				params = errstr[errstr.index("needkey ")+8:]
-				if params.find("!password?") < 0:
-					raise e
-				if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0:
-					raise e
 				self.open(mnt, req)
-				return
-			except:
-				raise e
+			except IOError, e:
+				try:
+					errstr = e.strerror
+					params = errstr[errstr.index("needkey ")+8:]
+					if params.find("!password?") < 0:
+						raise e
+					if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0:
+						raise e
+					loop = True
+				except:
+					raise e
 
 	def open(self, mnt, req):
 		if type(req) == str:
--