Skip to content

Commit

Permalink
liguohao improve
Browse files Browse the repository at this point in the history
  • Loading branch information
GehaFearless committed Jan 26, 2024
1 parent 62ef062 commit eaed147
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
10 changes: 4 additions & 6 deletions src/runtime/rpc/rpc_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ bool rpc_client_matcher::on_recv_reply(network *net, uint64_t key, message_ex *r
// if this is pure client (no server port assigned), we can only do fake forwarding,
// in this case, the server will return ERR_FORWARD_TO_OTHERS
if (err == ERR_FORWARD_TO_OTHERS) {
host_port hp;
::dsn::unmarshall((dsn::message_ex *)reply, hp);
std::shared_ptr<dns_resolver> resolver = std::make_shared<dns_resolver>();
auto addr = resolver->resolve_address(hp);
rpc_address addr;
::dsn::unmarshall((dsn::message_ex *)reply, addr);

// handle the case of forwarding to itself where addr == req->to_address.
DCHECK_NE_MSG(
Expand All @@ -153,7 +151,7 @@ bool rpc_client_matcher::on_recv_reply(network *net, uint64_t key, message_ex *r
case GRPC_TO_LEADER:
if (req->server_address.group_address()->is_update_leader_automatically()) {
req->server_address.group_address()->set_leader(addr);
req->server_host_port.group_host_port()->set_leader(hp);
req->server_host_port.group_host_port()->set_leader(host_prot(addr));
}
break;
default:
Expand Down Expand Up @@ -854,7 +852,7 @@ void rpc_engine::forward(message_ex *request, rpc_address address)
// we therefore cannot really do the forwarding but fake it
if (request->header->from_address.port() <= MAX_CLIENT_PORT) {
auto resp = request->create_response();
::dsn::marshall(resp, host_port(address));
::dsn::marshall(resp, address);
::dsn::task::get_current_rpc()->reply(resp, ::dsn::ERR_FORWARD_TO_OTHERS);
}

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/rpc/rpc_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ class message_ex : public ref_counter, public extensible_object<message_ex, 4>
rpc_session_ptr io_session; // send/recv session
rpc_address to_address; // always ipv4/v6 address, it is the to_node's net address
rpc_address server_address; // used by requests, and may be of uri/group address
host_port to_host_port; // fqdn from 'to_address', older versions use fqdn as net
host_port server_host_port; // fqdn from 'server_address', older versions use fqdn as net
host_port to_host_port; // fqdn from 'to_address'
host_port server_host_port; // fqdn from 'server_address'
dsn::task_code local_rpc_code;
network_header_format hdr_format;
int send_retry_count;
Expand Down
1 change: 0 additions & 1 deletion src/server/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
io_service_worker_count = 4
; how many connections can be established from one ip address to a server(both replica and meta), 0 means no threshold
conn_threshold_per_ip = 0
use_cache_resolve_hostname = true

; specification for each thread pool
[threadpool..default]
Expand Down
6 changes: 3 additions & 3 deletions src/server/test/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -493,15 +493,15 @@ profiler::cancelled = false
;profiler::timeout.qps = false

[meta_server]
server_list = 127.0.0.1:34701
server_list = 0.0.0.0:34701

[duplication-group]
onebox = 1
onebox2 = 2

[pegasus.clusters]
onebox = 127.0.0.1:34701
onebox2 = 127.0.0.1:35701
onebox = 0.0.0.0:34701
onebox2 = 0.0.0.0:35701

[pegasus.collector]
enable_detect_hotkey = true

0 comments on commit eaed147

Please sign in to comment.