##// END OF EJS Templates
wireprotoserver: make some instance attributes private...
Gregory Szorc -
r35888:f1efc0ca default
parent child Browse files
Show More
@@ -248,60 +248,60 def callhttp(repo, req, cmd):
248 248
249 249 class sshserver(abstractserverproto):
250 250 def __init__(self, ui, repo):
251 self.ui = ui
252 self.repo = repo
253 self.fin = ui.fin
254 self.fout = ui.fout
251 self._ui = ui
252 self._repo = repo
253 self._fin = ui.fin
254 self._fout = ui.fout
255 255 self.name = 'ssh'
256 256
257 257 hook.redirect(True)
258 258 ui.fout = repo.ui.fout = ui.ferr
259 259
260 260 # Prevent insertion/deletion of CRs
261 util.setbinary(self.fin)
262 util.setbinary(self.fout)
261 util.setbinary(self._fin)
262 util.setbinary(self._fout)
263 263
264 264 def getargs(self, args):
265 265 data = {}
266 266 keys = args.split()
267 267 for n in xrange(len(keys)):
268 argline = self.fin.readline()[:-1]
268 argline = self._fin.readline()[:-1]
269 269 arg, l = argline.split()
270 270 if arg not in keys:
271 271 raise error.Abort(_("unexpected parameter %r") % arg)
272 272 if arg == '*':
273 273 star = {}
274 274 for k in xrange(int(l)):
275 argline = self.fin.readline()[:-1]
275 argline = self._fin.readline()[:-1]
276 276 arg, l = argline.split()
277 val = self.fin.read(int(l))
277 val = self._fin.read(int(l))
278 278 star[arg] = val
279 279 data['*'] = star
280 280 else:
281 val = self.fin.read(int(l))
281 val = self._fin.read(int(l))
282 282 data[arg] = val
283 283 return [data[k] for k in keys]
284 284
285 285 def getfile(self, fpout):
286 286 self.sendresponse('')
287 count = int(self.fin.readline())
287 count = int(self._fin.readline())
288 288 while count:
289 fpout.write(self.fin.read(count))
290 count = int(self.fin.readline())
289 fpout.write(self._fin.read(count))
290 count = int(self._fin.readline())
291 291
292 292 def redirect(self):
293 293 pass
294 294
295 295 def sendresponse(self, v):
296 self.fout.write("%d\n" % len(v))
297 self.fout.write(v)
298 self.fout.flush()
296 self._fout.write("%d\n" % len(v))
297 self._fout.write(v)
298 self._fout.flush()
299 299
300 300 def sendstream(self, source):
301 write = self.fout.write
301 write = self._fout.write
302 302 for chunk in source.gen:
303 303 write(chunk)
304 self.fout.flush()
304 self._fout.flush()
305 305
306 306 def sendpushresponse(self, rsp):
307 307 self.sendresponse('')
@@ -311,10 +311,10 class sshserver(abstractserverproto):
311 311 self.sendresponse(rsp.res)
312 312
313 313 def sendooberror(self, rsp):
314 self.ui.ferr.write('%s\n-\n' % rsp.message)
315 self.ui.ferr.flush()
316 self.fout.write('\n')
317 self.fout.flush()
314 self._ui.ferr.write('%s\n-\n' % rsp.message)
315 self._ui.ferr.flush()
316 self._fout.write('\n')
317 self._fout.flush()
318 318
319 319 def serve_forever(self):
320 320 while self.serve_one():
@@ -331,9 +331,9 class sshserver(abstractserverproto):
331 331 }
332 332
333 333 def serve_one(self):
334 cmd = self.fin.readline()[:-1]
334 cmd = self._fin.readline()[:-1]
335 335 if cmd and cmd in wireproto.commands:
336 rsp = wireproto.dispatch(self.repo, self, cmd)
336 rsp = wireproto.dispatch(self._repo, self, cmd)
337 337 self.handlers[rsp.__class__](self, rsp)
338 338 elif cmd:
339 339 self.sendresponse("")
General Comments 0
You need to be logged in to leave comments. Login now