| | |
| | | unsigned short port = *(unsigned short*)(out); |
| | | copy_memory(reply, reply_len, (char*)out + port_size, out_len - port_size); |
| | | BHFree(out, out_len); |
| | | printf("======>> recv port %d\n", port); |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | |
| | | const auto& url_pub_proxy = get_url(URLPubProxy); |
| | |
| | | const auto& url_hb = get_url(URLHeartBeat); |
| | | respond_survey(url_hb, string{(const char*)proc_info, (const size_t)proc_info_len}); |
| | | |
| | | start_reply(pi.proc_id(), 0); |
| | | start_reply(pi.proc_id(), port); |
| | | } |
| | | return ret; |
| | | } |
| | |
| | | |
| | | auto url(get_url(URLQueryTopic)); |
| | | |
| | | if (remote && remote_len > 0){ |
| | | BHAddress addr; |
| | | if (addr.ParseFromArray(remote, remote_len)){ |
| | | if (!addr.ip().empty() && addr.port() > 0){ |
| | | // url = "tcp://" + addr.ip() + ":" + to_string(addr.port()); |
| | | printf("======>> BHQueryTopicAddress use remote address %s\n", url.c_str()); |
| | | } |
| | | } |
| | | } |
| | | // if (remote && remote_len > 0){ |
| | | // BHAddress addr; |
| | | // if (addr.ParseFromArray(remote, remote_len)){ |
| | | // if (!addr.ip().empty() && addr.port() > 0){ |
| | | // // url = "tcp://" + addr.ip() + ":" + to_string(addr.port()); |
| | | // printf("======>> BHQueryTopicAddress use remote address %s\n", url.c_str()); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | return simple_request(url, topic, topic_len, reply, reply_len, timeout_ms); |
| | | } |
| | |
| | | |
| | | auto url(get_url(URLQueryProcs)); |
| | | |
| | | if (remote && remote_len > 0){ |
| | | BHAddress addr; |
| | | if (addr.ParseFromArray(remote, remote_len)){ |
| | | if (!addr.ip().empty() && addr.port() > 0){ |
| | | // url = "tcp://" + addr.ip() + ":" + to_string(addr.port()); |
| | | printf("======>> BHQueryProcs use remote address %s\n", url.c_str()); |
| | | } |
| | | } |
| | | } |
| | | // if (remote && remote_len > 0){ |
| | | // BHAddress addr; |
| | | // if (addr.ParseFromArray(remote, remote_len)){ |
| | | // if (!addr.ip().empty() && addr.port() > 0){ |
| | | // // url = "tcp://" + addr.ip() + ":" + to_string(addr.port()); |
| | | // printf("======>> BHQueryProcs use remote address %s\n", url.c_str()); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | return simple_request(url, query, query_len, reply, reply_len, timeout_ms); |
| | | } |