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