Show More
@@ -533,10 +533,10 class chgcmdserver(commandserver.server) | |||||
533 | 'setumask': setumask}) |
|
533 | 'setumask': setumask}) | |
534 |
|
534 | |||
535 | class _requesthandler(commandserver._requesthandler): |
|
535 | class _requesthandler(commandserver._requesthandler): | |
536 | def _createcmdserver(self): |
|
536 | def _createcmdserver(self, conn, fin, fout): | |
537 | ui = self.server.ui |
|
537 | ui = self.server.ui | |
538 | repo = self.server.repo |
|
538 | repo = self.server.repo | |
539 |
return chgcmdserver(ui, repo, |
|
539 | return chgcmdserver(ui, repo, fin, fout, conn, | |
540 | self.server.hashstate, self.server.baseaddress) |
|
540 | self.server.hashstate, self.server.baseaddress) | |
541 |
|
541 | |||
542 | def _tempaddress(address): |
|
542 | def _tempaddress(address): |
@@ -338,7 +338,7 class pipeservice(object): | |||||
338 | sv.cleanup() |
|
338 | sv.cleanup() | |
339 | _restoreio(ui, fin, fout) |
|
339 | _restoreio(ui, fin, fout) | |
340 |
|
340 | |||
341 |
class _requesthandler(socketserver. |
|
341 | class _requesthandler(socketserver.BaseRequestHandler): | |
342 | def handle(self): |
|
342 | def handle(self): | |
343 | # use a different process group from the master process, making this |
|
343 | # use a different process group from the master process, making this | |
344 | # process pass kernel "is_current_pgrp_orphaned" check so signals like |
|
344 | # process pass kernel "is_current_pgrp_orphaned" check so signals like | |
@@ -348,9 +348,13 class _requesthandler(socketserver.Strea | |||||
348 | # same state inherited from parent. |
|
348 | # same state inherited from parent. | |
349 | random.seed() |
|
349 | random.seed() | |
350 | ui = self.server.ui |
|
350 | ui = self.server.ui | |
|
351 | ||||
|
352 | conn = self.request | |||
|
353 | fin = conn.makefile('rb') | |||
|
354 | fout = conn.makefile('wb') | |||
351 | sv = None |
|
355 | sv = None | |
352 | try: |
|
356 | try: | |
353 | sv = self._createcmdserver() |
|
357 | sv = self._createcmdserver(conn, fin, fout) | |
354 | try: |
|
358 | try: | |
355 | sv.serve() |
|
359 | sv.serve() | |
356 | # handle exceptions that may be raised by command server. most of |
|
360 | # handle exceptions that may be raised by command server. most of | |
@@ -370,17 +374,23 class _requesthandler(socketserver.Strea | |||||
370 | if sv: |
|
374 | if sv: | |
371 | cerr = sv.cerr |
|
375 | cerr = sv.cerr | |
372 | else: |
|
376 | else: | |
373 |
cerr = channeledoutput( |
|
377 | cerr = channeledoutput(fout, 'e') | |
374 | traceback.print_exc(file=cerr) |
|
378 | traceback.print_exc(file=cerr) | |
375 | raise |
|
379 | raise | |
376 | finally: |
|
380 | finally: | |
|
381 | fin.close() | |||
|
382 | try: | |||
|
383 | fout.close() # implicit flush() may cause another EPIPE | |||
|
384 | except IOError as inst: | |||
|
385 | if inst.errno != errno.EPIPE: | |||
|
386 | raise | |||
377 | # trigger __del__ since ForkingMixIn uses os._exit |
|
387 | # trigger __del__ since ForkingMixIn uses os._exit | |
378 | gc.collect() |
|
388 | gc.collect() | |
379 |
|
389 | |||
380 | def _createcmdserver(self): |
|
390 | def _createcmdserver(self, conn, fin, fout): | |
381 | ui = self.server.ui |
|
391 | ui = self.server.ui | |
382 | repo = self.server.repo |
|
392 | repo = self.server.repo | |
383 |
return server(ui, repo, |
|
393 | return server(ui, repo, fin, fout) | |
384 |
|
394 | |||
385 | class unixservice(object): |
|
395 | class unixservice(object): | |
386 | """ |
|
396 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now