##// 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 # same state inherited from parent.
545 # same state inherited from parent.
546 random.seed()
546 random.seed()
547 ui = self.server.ui
547 ui = self.server.ui
548 repo = self.server.repo
549 sv = None
548 sv = None
550 try:
549 try:
551 sv = chgcmdserver(ui, repo, self.rfile, self.wfile, self.connection,
550 sv = self._createcmdserver()
552 self.server.hashstate, self.server.baseaddress)
553 try:
551 try:
554 sv.serve()
552 sv.serve()
555 # handle exceptions that may be raised by command server. most of
553 # handle exceptions that may be raised by command server. most of
@@ -576,6 +574,12 b' class _requesthandler(socketserver.Strea'
576 # trigger __del__ since ForkingMixIn uses os._exit
574 # trigger __del__ since ForkingMixIn uses os._exit
577 gc.collect()
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 def _tempaddress(address):
583 def _tempaddress(address):
580 return '%s.%d.tmp' % (address, os.getpid())
584 return '%s.%d.tmp' % (address, os.getpid())
581
585
@@ -334,10 +334,9 b' class pipeservice(object):'
334 class _requesthandler(socketserver.StreamRequestHandler):
334 class _requesthandler(socketserver.StreamRequestHandler):
335 def handle(self):
335 def handle(self):
336 ui = self.server.ui
336 ui = self.server.ui
337 repo = self.server.repo
338 sv = None
337 sv = None
339 try:
338 try:
340 sv = server(ui, repo, self.rfile, self.wfile)
339 sv = self._createcmdserver()
341 try:
340 try:
342 sv.serve()
341 sv.serve()
343 # handle exceptions that may be raised by command server. most of
342 # handle exceptions that may be raised by command server. most of
@@ -359,6 +358,11 b' class _requesthandler(socketserver.Strea'
359 traceback.print_exc(file=cerr)
358 traceback.print_exc(file=cerr)
360 raise
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 class unixservice(object):
366 class unixservice(object):
363 """
367 """
364 Listens on unix domain socket and forks server per connection
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