mercurial/httppeer.py
changeset 48835 a0da5075bca3
parent 48526 04688c51f81f
child 48875 6000f5b25c9b
equal deleted inserted replaced
48834:029b76d645dc 48835:a0da5075bca3
    12 import io
    12 import io
    13 import os
    13 import os
    14 import socket
    14 import socket
    15 import struct
    15 import struct
    16 
    16 
       
    17 from concurrent import futures
    17 from .i18n import _
    18 from .i18n import _
    18 from .pycompat import getattr
    19 from .pycompat import getattr
    19 from . import (
    20 from . import (
    20     bundle2,
    21     bundle2,
    21     error,
    22     error,
   536 
   537 
   537     def _abort(self, exception):
   538     def _abort(self, exception):
   538         raise exception
   539         raise exception
   539 
   540 
   540 
   541 
   541 class queuedcommandfuture(pycompat.futures.Future):
   542 class queuedcommandfuture(futures.Future):
   542     """Wraps result() on command futures to trigger submission on call."""
   543     """Wraps result() on command futures to trigger submission on call."""
   543 
   544 
   544     def result(self, timeout=None):
   545     def result(self, timeout=None):
   545         if self.done():
   546         if self.done():
   546             return pycompat.futures.Future.result(self, timeout)
   547             return futures.Future.result(self, timeout)
   547 
   548 
   548         self._peerexecutor.sendcommands()
   549         self._peerexecutor.sendcommands()
   549 
   550 
   550         # sendcommands() will restore the original __class__ and self.result
   551         # sendcommands() will restore the original __class__ and self.result
   551         # will resolve to Future.result.
   552         # will resolve to Future.result.