##// END OF EJS Templates
commandserver: extract function that serves for the current connection...
Yuya Nishihara -
r29543:d74b8a4f default
parent child Browse files
Show More
@@ -533,9 +533,8 class chgcmdserver(commandserver.server)
533 533 'setumask': setumask})
534 534
535 535 class _requesthandler(commandserver._requesthandler):
536 def _createcmdserver(self, conn, fin, fout):
536 def _createcmdserver(self, repo, conn, fin, fout):
537 537 ui = self.server.ui
538 repo = self.server.repo
539 538 return chgcmdserver(ui, repo, fin, fout, conn,
540 539 self.server.hashstate, self.server.baseaddress)
541 540
@@ -338,8 +338,8 class pipeservice(object):
338 338 sv.cleanup()
339 339 _restoreio(ui, fin, fout)
340 340
341 class _requesthandler(socketserver.BaseRequestHandler):
342 def handle(self):
341 def _serverequest(ui, repo, conn, createcmdserver):
342 if True: # TODO: unindent
343 343 # use a different process group from the master process, making this
344 344 # process pass kernel "is_current_pgrp_orphaned" check so signals like
345 345 # SIGTSTP, SIGTTIN, SIGTTOU are not ignored.
@@ -347,14 +347,12 class _requesthandler(socketserver.BaseR
347 347 # change random state otherwise forked request handlers would have a
348 348 # same state inherited from parent.
349 349 random.seed()
350 ui = self.server.ui
351 350
352 conn = self.request
353 351 fin = conn.makefile('rb')
354 352 fout = conn.makefile('wb')
355 353 sv = None
356 354 try:
357 sv = self._createcmdserver(conn, fin, fout)
355 sv = createcmdserver(repo, conn, fin, fout)
358 356 try:
359 357 sv.serve()
360 358 # handle exceptions that may be raised by command server. most of
@@ -387,9 +385,13 class _requesthandler(socketserver.BaseR
387 385 # trigger __del__ since ForkingMixIn uses os._exit
388 386 gc.collect()
389 387
390 def _createcmdserver(self, conn, fin, fout):
388 class _requesthandler(socketserver.BaseRequestHandler):
389 def handle(self):
390 _serverequest(self.server.ui, self.server.repo, self.request,
391 self._createcmdserver)
392
393 def _createcmdserver(self, repo, conn, fin, fout):
391 394 ui = self.server.ui
392 repo = self.server.repo
393 395 return server(ui, repo, fin, fout)
394 396
395 397 class unixservice(object):
General Comments 0
You need to be logged in to leave comments. Login now