@@ -783,9 +783,10 @@ def run(self) -> None: # pylint: disable=too-many-branches
783783 # state can be None if reset from the UI
784784 # In this case, default parameters will be used but SSE Client needs to be restarted
785785 if state is None :
786- self .exit = True
787- state ["start_from" ] = str (msg .id )
788- self .helper .set_state (state )
786+ self .exit_event .set ()
787+ else :
788+ state ["start_from" ] = str (msg .id )
789+ self .helper .set_state (state )
789790 except Exception as ex :
790791 self .helper .connector_logger .error (
791792 "Error in ListenStream loop, exit." , {"reason" : str (ex )}
@@ -1812,9 +1813,9 @@ def send_stix2_bundle(self, bundle: str, **kwargs) -> list:
18121813 )
18131814 )
18141815 else :
1815- octi_extensions ["granted_refs" ] = (
1816- self . enrichment_shared_organizations
1817- )
1816+ octi_extensions [
1817+ "granted_refs"
1818+ ] = self . enrichment_shared_organizations
18181819 else :
18191820 if item .get ("x_opencti_granted_refs" ) is not None :
18201821 item ["x_opencti_granted_refs" ] = list (
@@ -1824,9 +1825,9 @@ def send_stix2_bundle(self, bundle: str, **kwargs) -> list:
18241825 )
18251826 )
18261827 else :
1827- item ["x_opencti_granted_refs" ] = (
1828- self . enrichment_shared_organizations
1829- )
1828+ item [
1829+ "x_opencti_granted_refs"
1830+ ] = self . enrichment_shared_organizations
18301831 bundle = json .dumps (bundle_data )
18311832
18321833 # If execution in playbook, callback the api
@@ -1919,13 +1920,15 @@ def send_stix2_bundle(self, bundle: str, **kwargs) -> list:
19191920 os .rename (write_file , final_write_file )
19201921
19211922 stix2_splitter = OpenCTIStix2Splitter ()
1922- (expectations_number , _ , bundles ) = (
1923- stix2_splitter .split_bundle_with_expectations (
1924- bundle = bundle ,
1925- use_json = True ,
1926- event_version = event_version ,
1927- cleanup_inconsistent_bundle = cleanup_inconsistent_bundle ,
1928- )
1923+ (
1924+ expectations_number ,
1925+ _ ,
1926+ bundles ,
1927+ ) = stix2_splitter .split_bundle_with_expectations (
1928+ bundle = bundle ,
1929+ use_json = True ,
1930+ event_version = event_version ,
1931+ cleanup_inconsistent_bundle = cleanup_inconsistent_bundle ,
19291932 )
19301933
19311934 if len (bundles ) == 0 :
0 commit comments