diff --git a/synapse/client/config.py b/synapse/client/config.py index afb68dc..168000c 100644 --- a/synapse/client/config.py +++ b/synapse/client/config.py @@ -4,11 +4,9 @@ class Config(object): - nodes = [] - connections = [] - def __init__(self): - pass + self.nodes = [] + self.connections = [] def _gen_node_id(self): return len(self.nodes) + 1 diff --git a/synapse/server/entrypoint.py b/synapse/server/entrypoint.py index 0511fa6..99b5037 100644 --- a/synapse/server/entrypoint.py +++ b/synapse/server/entrypoint.py @@ -63,6 +63,13 @@ def main( ) args = parser.parse_args() + # if these contain spaces, the discovery will fail because the broadcast + # packet is parsed with str.split() in discover.py and each space marks a new token + if " " in args.name: + parser.error("--name must not contain spaces") + if " " in args.serial: + parser.error("--serial must not contain spaces") + init_logging(level=logging.DEBUG if args.verbose else logging.INFO) # verify that network interface is real diff --git a/synapse/simulator/nodes/broadband_source.py b/synapse/simulator/nodes/broadband_source.py index bbe4deb..b2e3ebe 100644 --- a/synapse/simulator/nodes/broadband_source.py +++ b/synapse/simulator/nodes/broadband_source.py @@ -78,6 +78,9 @@ async def run(self): now = time.time_ns() elapsed_ns = now - t_last_ns n_samples = int(sample_rate_hz * elapsed_ns / 1e9) + if n_samples == 0: + continue + samples = [[ch.id, [r_sample(bit_width) for _ in range(n_samples)]] for ch in channels] try: @@ -105,7 +108,7 @@ async def run(self): except Exception as e: self.logger.error(f"Error sending data: {e}") - t_last_ns = now + t_last_ns += int(n_samples * 1e9 / sample_rate_hz) except Exception as e: print(f"Error sending data: {e}")