##// END OF EJS Templates
sshpeer: use `iter(callable, sentinel)` instead of while True...
Augie Fackler -
r29727:0dbd788a default
parent child Browse files
Show More
@@ -292,10 +292,7 b' class sshpeer(wireproto.wirepeer):'
292 r = self._call(cmd, **args)
292 r = self._call(cmd, **args)
293 if r:
293 if r:
294 return '', r
294 return '', r
295 while True:
295 for d in iter(lambda: fp.read(4096), ''):
296 d = fp.read(4096)
297 if not d:
298 break
299 self._send(d)
296 self._send(d)
300 self._send("", flush=True)
297 self._send("", flush=True)
301 r = self._recv()
298 r = self._recv()
@@ -308,10 +305,7 b' class sshpeer(wireproto.wirepeer):'
308 if r:
305 if r:
309 # XXX needs to be made better
306 # XXX needs to be made better
310 raise error.Abort(_('unexpected remote reply: %s') % r)
307 raise error.Abort(_('unexpected remote reply: %s') % r)
311 while True:
308 for d in iter(lambda: fp.read(4096), ''):
312 d = fp.read(4096)
313 if not d:
314 break
315 self._send(d)
309 self._send(d)
316 self._send("", flush=True)
310 self._send("", flush=True)
317 return self.pipei
311 return self.pipei
@@ -353,10 +347,7 b' class sshpeer(wireproto.wirepeer):'
353 d = self._call("addchangegroup")
347 d = self._call("addchangegroup")
354 if d:
348 if d:
355 self._abort(error.RepoError(_("push refused: %s") % d))
349 self._abort(error.RepoError(_("push refused: %s") % d))
356 while True:
350 for d in iter(lambda: cg.read(4096), ''):
357 d = cg.read(4096)
358 if not d:
359 break
360 self.pipeo.write(d)
351 self.pipeo.write(d)
361 self.readerr()
352 self.readerr()
362
353
General Comments 0
You need to be logged in to leave comments. Login now