Mercurial > hg
diff mercurial/commandserver.py @ 29511:540c01a18bb7
commandserver: extract method to create commandserver instance per request
This is a step toward merging chgserver._requesthandler with commandserver's.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 21 May 2016 15:12:19 +0900 |
parents | 33770d2b6cf9 |
children | 538d0003c9e0 |
line wrap: on
line diff
--- a/mercurial/commandserver.py Mon Jul 11 21:40:02 2016 +0900 +++ b/mercurial/commandserver.py Sat May 21 15:12:19 2016 +0900 @@ -334,10 +334,9 @@ class _requesthandler(socketserver.StreamRequestHandler): def handle(self): ui = self.server.ui - repo = self.server.repo sv = None try: - sv = server(ui, repo, self.rfile, self.wfile) + sv = self._createcmdserver() try: sv.serve() # handle exceptions that may be raised by command server. most of @@ -359,6 +358,11 @@ traceback.print_exc(file=cerr) raise + def _createcmdserver(self): + ui = self.server.ui + repo = self.server.repo + return server(ui, repo, self.rfile, self.wfile) + class unixservice(object): """ Listens on unix domain socket and forks server per connection