##// END OF EJS Templates
commandserver: extract method to create commandserver instance per request...
Yuya Nishihara -
r29511:540c01a1 default
parent child Browse files
Show More
@@ -545,11 +545,9 b' class _requesthandler(socketserver.Strea'
545 545 # same state inherited from parent.
546 546 random.seed()
547 547 ui = self.server.ui
548 repo = self.server.repo
549 548 sv = None
550 549 try:
551 sv = chgcmdserver(ui, repo, self.rfile, self.wfile, self.connection,
552 self.server.hashstate, self.server.baseaddress)
550 sv = self._createcmdserver()
553 551 try:
554 552 sv.serve()
555 553 # handle exceptions that may be raised by command server. most of
@@ -576,6 +574,12 b' class _requesthandler(socketserver.Strea'
576 574 # trigger __del__ since ForkingMixIn uses os._exit
577 575 gc.collect()
578 576
577 def _createcmdserver(self):
578 ui = self.server.ui
579 repo = self.server.repo
580 return chgcmdserver(ui, repo, self.rfile, self.wfile, self.connection,
581 self.server.hashstate, self.server.baseaddress)
582
579 583 def _tempaddress(address):
580 584 return '%s.%d.tmp' % (address, os.getpid())
581 585
@@ -334,10 +334,9 b' class pipeservice(object):'
334 334 class _requesthandler(socketserver.StreamRequestHandler):
335 335 def handle(self):
336 336 ui = self.server.ui
337 repo = self.server.repo
338 337 sv = None
339 338 try:
340 sv = server(ui, repo, self.rfile, self.wfile)
339 sv = self._createcmdserver()
341 340 try:
342 341 sv.serve()
343 342 # handle exceptions that may be raised by command server. most of
@@ -359,6 +358,11 b' class _requesthandler(socketserver.Strea'
359 358 traceback.print_exc(file=cerr)
360 359 raise
361 360
361 def _createcmdserver(self):
362 ui = self.server.ui
363 repo = self.server.repo
364 return server(ui, repo, self.rfile, self.wfile)
365
362 366 class unixservice(object):
363 367 """
364 368 Listens on unix domain socket and forks server per connection
General Comments 0
You need to be logged in to leave comments. Login now