示例#1
0
def run_radio_station_as_process_and_stub(port):
    process = run_radio_station_as_process(port)
    channel = grpc.insecure_channel('localhost:' + str(port))
    stub = loopchain_pb2_grpc.RadioStationStub(channel)
    util.request_server_in_time(stub.GetStatus,
                                loopchain_pb2.StatusRequest(request=""))
    return process, stub
示例#2
0
def run_radio_station_as_process_and_stub_manager(port):
    process = run_radio_station_as_process(port)
    stub_manager = StubManager.get_stub_manager_to_server(
        'localhost:' + str(port), loopchain_pb2_grpc.RadioStationStub)
    util.request_server_in_time(stub_manager.stub.GetStatus,
                                loopchain_pb2.StatusRequest(request=""))
    return process, stub_manager
示例#3
0
def run_radio_station_as_process_and_stub_manager(port, timeout=None):
    process = run_radio_station_as_process(port)
    stub_manager = StubManager(f"localhost:{port}",
                               loopchain_pb2_grpc.RadioStationStub,
                               conf.GRPC_SSL_TYPE)
    util.request_server_in_time(stub_manager.stub.GetStatus,
                                loopchain_pb2.StatusRequest(request=""))
    return process, stub_manager
示例#4
0
def run_peer_server_as_process_and_stub(
        port,
        radiostation_port=conf.PORT_RADIOSTATION,
        group_id=None,
        score=None):
    process = run_peer_server_as_process(port, radiostation_port, group_id,
                                         score)
    channel = grpc.insecure_channel('localhost:' + str(port))
    stub = loopchain_pb2_grpc.PeerServiceStub(channel)
    util.request_server_in_time(stub.GetStatus,
                                loopchain_pb2.StatusRequest(request=""))
    return process, stub