@@ -1222,7 +1222,9 @@ def wait_for_done_workers(
12221222 done_sccs = []
12231223 results = {}
12241224 for idx in ready_to_read ([w .conn for w in self .workers ], WORKER_DONE_TIMEOUT ):
1225- data = SccResponseMessage .read (receive (self .workers [idx ].conn ))
1225+ buf = receive (self .workers [idx ].conn )
1226+ assert read_tag (buf ) == SCC_RESPONSE_MESSAGE
1227+ data = SccResponseMessage .read (buf )
12261228 self .free_workers .add (idx )
12271229 scc_id = data .scc_id
12281230 if data .blocker is not None :
@@ -4165,7 +4167,8 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
41654167 graph_message .write (buf )
41664168 graph_data = buf .getvalue ()
41674169 for worker in manager .workers :
4168- AckMessage .read (receive (worker .conn ))
4170+ buf = receive (worker .conn )
4171+ assert read_tag (buf ) == ACK_MESSAGE
41694172 worker .conn .write_bytes (graph_data )
41704173
41714174 sccs = sorted_components (graph )
@@ -4185,10 +4188,12 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
41854188 sccs_message .write (buf )
41864189 sccs_data = buf .getvalue ()
41874190 for worker in manager .workers :
4188- AckMessage .read (receive (worker .conn ))
4191+ buf = receive (worker .conn )
4192+ assert read_tag (buf ) == ACK_MESSAGE
41894193 worker .conn .write_bytes (sccs_data )
41904194 for worker in manager .workers :
4191- AckMessage .read (receive (worker .conn ))
4195+ buf = receive (worker .conn )
4196+ assert read_tag (buf ) == ACK_MESSAGE
41924197
41934198 manager .free_workers = set (range (manager .options .num_workers ))
41944199
@@ -4620,7 +4625,6 @@ class AckMessage(IPCMessage):
46204625
46214626 @classmethod
46224627 def read (cls , buf : ReadBuffer ) -> AckMessage :
4623- assert read_tag (buf ) == ACK_MESSAGE
46244628 return AckMessage ()
46254629
46264630 def write (self , buf : WriteBuffer ) -> None :
@@ -4647,7 +4651,6 @@ def __init__(
46474651
46484652 @classmethod
46494653 def read (cls , buf : ReadBuffer ) -> SccRequestMessage :
4650- assert read_tag (buf ) == SCC_REQUEST_MESSAGE
46514654 return SccRequestMessage (
46524655 scc_id = read_int_opt (buf ),
46534656 import_errors = {
@@ -4708,7 +4711,6 @@ def __init__(
47084711
47094712 @classmethod
47104713 def read (cls , buf : ReadBuffer ) -> SccResponseMessage :
4711- assert read_tag (buf ) == SCC_RESPONSE_MESSAGE
47124714 scc_id = read_int (buf )
47134715 tag = read_tag (buf )
47144716 if tag == LITERAL_NONE :
@@ -4753,7 +4755,6 @@ def __init__(self, *, sources: list[BuildSource]) -> None:
47534755
47544756 @classmethod
47554757 def read (cls , buf : ReadBuffer ) -> SourcesDataMessage :
4756- assert read_tag (buf ) == SOURCES_DATA_MESSAGE
47574758 sources = [
47584759 BuildSource (
47594760 read_str_opt (buf ),
@@ -4785,7 +4786,6 @@ def __init__(self, *, sccs: list[SCC]) -> None:
47854786
47864787 @classmethod
47874788 def read (cls , buf : ReadBuffer ) -> SccsDataMessage :
4788- assert read_tag (buf ) == SCCS_DATA_MESSAGE
47894789 sccs = [
47904790 SCC (set (read_str_list (buf )), read_int (buf ), read_int_list (buf ))
47914791 for _ in range (read_int_bare (buf ))
@@ -4813,7 +4813,6 @@ def __init__(self, *, graph: Graph, missing_modules: dict[str, int]) -> None:
48134813 @classmethod
48144814 def read (cls , buf : ReadBuffer , manager : BuildManager | None = None ) -> GraphMessage :
48154815 assert manager is not None
4816- assert read_tag (buf ) == GRAPH_MESSAGE
48174816 graph = {read_str_bare (buf ): State .read (buf , manager ) for _ in range (read_int_bare (buf ))}
48184817 missing_modules = {read_str_bare (buf ): read_int (buf ) for _ in range (read_int_bare (buf ))}
48194818 message = GraphMessage (graph = graph , missing_modules = missing_modules )
0 commit comments