int get_counter_port(const char *ip, char *type, connection_t *connection, unsigned short *port) { endpoint_t *counter_endpoint = NULL; if (strcmp(*(connection->request_endpoint_ip), ip) == 0) { counter_endpoint = connection->response_endpoint; } if (strcmp(*(connection->response_endpoint_ip), ip) == 0) { counter_endpoint = connection->request_endpoint; } if (counter_endpoint == NULL) { ERR("counter endpoint not found\n"); return -1; } if (get_stream_port(counter_endpoint->streams, type, port) == -1) { ERR("Cannot find counter part stream with type '%s'\n", type); return -1; } return 0; }
inline krpc::Client server_test::connect() { return krpc::connect("C++ClientTest", "localhost", get_rpc_port(), get_stream_port()); }