Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 067d157

Browse files
committed
[client]: unify empty state handling
1 parent 7ac955d commit 067d157

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

pycti/connector/opencti_connector_helper.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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)}
@@ -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

Comments
 (0)