Mercurial > hg
comparison mercurial/wireprotoframing.py @ 40129:293835e0fff7
wireprotov2: pass ui into clientreactor and serverreactor
This will allow us to use config options to influence compression
settings.
Differential Revision: https://phab.mercurial-scm.org/D4919
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 04 Oct 2018 17:17:57 -0700 |
parents | 57782791b7e9 |
children | 5d44c4d1d516 |
comparison
equal
deleted
inserted
replaced
40128:57782791b7e9 | 40129:293835e0fff7 |
---|---|
748 that if we receive a command and instruct its dispatch, another command | 748 that if we receive a command and instruct its dispatch, another command |
749 with its request ID can come in over the wire and there will be a race | 749 with its request ID can come in over the wire and there will be a race |
750 between who responds to what. | 750 between who responds to what. |
751 """ | 751 """ |
752 | 752 |
753 def __init__(self, deferoutput=False): | 753 def __init__(self, ui, deferoutput=False): |
754 """Construct a new server reactor. | 754 """Construct a new server reactor. |
755 | 755 |
756 ``deferoutput`` can be used to indicate that no output frames should be | 756 ``deferoutput`` can be used to indicate that no output frames should be |
757 instructed to be sent until input has been exhausted. In this mode, | 757 instructed to be sent until input has been exhausted. In this mode, |
758 events that would normally generate output frames (such as a command | 758 events that would normally generate output frames (such as a command |
759 response being ready) will instead defer instructing the consumer to | 759 response being ready) will instead defer instructing the consumer to |
760 send those frames. This is useful for half-duplex transports where the | 760 send those frames. This is useful for half-duplex transports where the |
761 sender cannot receive until all data has been transmitted. | 761 sender cannot receive until all data has been transmitted. |
762 """ | 762 """ |
763 self._ui = ui | |
763 self._deferoutput = deferoutput | 764 self._deferoutput = deferoutput |
764 self._state = 'initial' | 765 self._state = 'initial' |
765 self._nextoutgoingstreamid = 2 | 766 self._nextoutgoingstreamid = 2 |
766 self._bufferedframegens = [] | 767 self._bufferedframegens = [] |
767 # stream id -> stream instance for all active streams from the client. | 768 # stream id -> stream instance for all active streams from the client. |
1349 | 1350 |
1350 ``expectmore`` and ``eos`` evaluate to True when more response data | 1351 ``expectmore`` and ``eos`` evaluate to True when more response data |
1351 is expected to follow or we're at the end of the response stream, | 1352 is expected to follow or we're at the end of the response stream, |
1352 respectively. | 1353 respectively. |
1353 """ | 1354 """ |
1354 def __init__(self, hasmultiplesend=False, buffersends=True): | 1355 def __init__(self, ui, hasmultiplesend=False, buffersends=True): |
1355 """Create a new instance. | 1356 """Create a new instance. |
1356 | 1357 |
1357 ``hasmultiplesend`` indicates whether multiple sends are supported | 1358 ``hasmultiplesend`` indicates whether multiple sends are supported |
1358 by the transport. When True, it is possible to send commands immediately | 1359 by the transport. When True, it is possible to send commands immediately |
1359 instead of buffering until the caller signals an intent to finish a | 1360 instead of buffering until the caller signals an intent to finish a |
1360 send operation. | 1361 send operation. |
1361 | 1362 |
1362 ``buffercommands`` indicates whether sends should be buffered until the | 1363 ``buffercommands`` indicates whether sends should be buffered until the |
1363 last request has been issued. | 1364 last request has been issued. |
1364 """ | 1365 """ |
1366 self._ui = ui | |
1365 self._hasmultiplesend = hasmultiplesend | 1367 self._hasmultiplesend = hasmultiplesend |
1366 self._buffersends = buffersends | 1368 self._buffersends = buffersends |
1367 | 1369 |
1368 self._canissuecommands = True | 1370 self._canissuecommands = True |
1369 self._cansend = True | 1371 self._cansend = True |