#!/usr/bin/env python3
#
# Return participant-specific data for a run
#

import pscheduler
import sys
import nuttcp_utils
from nuttcp_defaults import *

json = pscheduler.json_load(exit_on_error=True)
result = {}

try:
    participant = json['participant']
except KeyError:
    pscheduler.fail("Missing participant")

config = nuttcp_utils.get_config()

# Nothing else interesting for sender
if participant == 0:
    pass
# Receiver has to figure out what port it's going
# to listen on
elif participant == 1:
    result["server_port"]     = config["server_port"]
    result["data_port_start"] = config["data_port_start"]
else:
    pscheduler.fail("Invalid participant number for this test")

pscheduler.succeed_json(result)
