@@ -1186,18 +1186,8 @@ def on_unrecognized_partial_line_received(self, line):
11861186
11871187class BootstrapProtocol (RegexProtocol ):
11881188 """
1189- Respond to stdout of a child during bootstrap. Wait for :attr:`EC0_MARKER`
1190- to be written by the first stage to indicate it can receive the bootstrap,
1191- then await :attr:`EC1_MARKER` to indicate success, and
1192- :class:`MitogenProtocol` can be enabled.
1193- """
1194- #: Sentinel value emitted by the first stage to indicate it is ready to
1195- #: receive the compressed bootstrap. For :mod:`mitogen.ssh` this must have
1196- #: length of at least `max(len('password'), len('debug1:'))`
1197- EC0_MARKER = b ('MITO000' )
1198- EC1_MARKER = b ('MITO001' )
1199- EC2_MARKER = b ('MITO002' )
1200-
1189+ Respond to readiness markers sent to parent by child doing bootstrap.
1190+ """
12011191 def __init__ (self , broker ):
12021192 super (BootstrapProtocol , self ).__init__ ()
12031193 self ._writer = mitogen .core .BufferedWriter (broker , self )
@@ -1213,7 +1203,11 @@ def _on_ec1_received(self, line, match):
12131203 LOG .debug ('%r: first stage received mitogen.core source' , self )
12141204
12151205 def _on_ec2_received (self , line , match ):
1216- LOG .debug ('%r: new child booted successfully' , self )
1206+ py_major , py_minor = int (match .group (1 )), int (match .group (2 ))
1207+ LOG .debug (
1208+ '%r: new child booted successfully on Python %d.%d' ,
1209+ self , py_major , py_minor ,
1210+ )
12171211 self .stream .conn ._complete_connection ()
12181212 return False
12191213
@@ -1222,9 +1216,9 @@ def on_unrecognized_line_received(self, line):
12221216 line .decode ('utf-8' , 'replace' ))
12231217
12241218 PATTERNS = [
1225- (re .compile (EC0_MARKER ), _on_ec0_received ),
1226- (re .compile (EC1_MARKER ), _on_ec1_received ),
1227- (re .compile (EC2_MARKER ), _on_ec2_received ),
1219+ (re .compile (mitogen . core . EC0 ), _on_ec0_received ),
1220+ (re .compile (mitogen . core . EC1 ), _on_ec1_received ),
1221+ (re .compile (mitogen . core . EC2_PATTERN ), _on_ec2_received ),
12281222 ]
12291223
12301224
0 commit comments