##// END OF EJS Templates
server: externalize and streamline mixin setup
Dirkjan Ochtman -
r10639:a6808629 default
parent child Browse files
Show More
@@ -195,8 +195,17 class _shgwebhandler(_hgwebhandler):
195 self.close_connection = True
195 self.close_connection = True
196 pass
196 pass
197
197
198 try:
199 from threading import activeCount
200 _mixin = SocketServer.ThreadingMixIn
201 except ImportError:
202 if hasattr(os, "fork"):
203 _mixin = SocketServer.ForkingMixIn
204 else:
205 class _mixin:
206 pass
207
198 def create_server(ui, repo):
208 def create_server(ui, repo):
199 use_threads = True
200
209
201 def openlog(opt, default):
210 def openlog(opt, default):
202 if opt and opt != '-':
211 if opt and opt != '-':
@@ -218,21 +227,6 def create_server(ui, repo):
218 accesslog = openlog(myui.config("web", "accesslog", "-"), sys.stdout)
227 accesslog = openlog(myui.config("web", "accesslog", "-"), sys.stdout)
219 errorlog = openlog(myui.config("web", "errorlog", "-"), sys.stderr)
228 errorlog = openlog(myui.config("web", "errorlog", "-"), sys.stderr)
220
229
221 if use_threads:
222 try:
223 from threading import activeCount
224 except ImportError:
225 use_threads = False
226
227 if use_threads:
228 _mixin = SocketServer.ThreadingMixIn
229 else:
230 if hasattr(os, "fork"):
231 _mixin = SocketServer.ForkingMixIn
232 else:
233 class _mixin:
234 pass
235
236 if webdir_conf:
230 if webdir_conf:
237 hgwebobj = hgwebdir(webdir_conf, ui)
231 hgwebobj = hgwebdir(webdir_conf, ui)
238 elif repo is not None:
232 elif repo is not None:
General Comments 0
You need to be logged in to leave comments. Login now