This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 501583ca6 refactor(FQDN): Make address() and host_port() members
return const reference types (#1952)
501583ca6 is described below
commit 501583ca620a4fa1593fc48386f76bb1f226a523
Author: Yingchun Lai <[email protected]>
AuthorDate: Fri Apr 12 11:18:33 2024 +0800
refactor(FQDN): Make address() and host_port() members return const
reference types (#1952)
---
src/meta/meta_data.h | 2 +-
src/runtime/rpc/asio_net_provider.h | 8 ++++----
src/runtime/rpc/network.h | 4 ++--
src/runtime/rpc/network.sim.h | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/meta/meta_data.h b/src/meta/meta_data.h
index 05ee95790..16cf35912 100644
--- a/src/meta/meta_data.h
+++ b/src/meta/meta_data.h
@@ -417,7 +417,7 @@ public:
void set_alive(bool alive) { is_alive = alive; }
bool has_collected() { return has_collected_replicas; }
void set_replicas_collect_flag(bool has_collected) {
has_collected_replicas = has_collected; }
- dsn::host_port host_port() const { return hp; }
+ const dsn::host_port &host_port() const { return hp; }
void set_hp(const dsn::host_port &val) { hp = val; }
void put_partition(const dsn::gpid &pid, bool is_primary);
diff --git a/src/runtime/rpc/asio_net_provider.h
b/src/runtime/rpc/asio_net_provider.h
index 774a6b575..20eb6f9d9 100644
--- a/src/runtime/rpc/asio_net_provider.h
+++ b/src/runtime/rpc/asio_net_provider.h
@@ -79,8 +79,8 @@ public:
~asio_network_provider() override;
virtual error_code start(rpc_channel channel, int port, bool client_only)
override;
- virtual ::dsn::rpc_address address() override { return _address; }
- virtual ::dsn::host_port host_port() override { return _hp; }
+ const ::dsn::rpc_address &address() const override { return _address; }
+ const ::dsn::host_port &host_port() const override { return _hp; }
virtual rpc_session_ptr create_client_session(::dsn::rpc_address
server_addr) override;
private:
@@ -110,9 +110,9 @@ public:
virtual error_code start(rpc_channel channel, int port, bool client_only)
override;
- virtual ::dsn::rpc_address address() override { return _address; }
+ const ::dsn::rpc_address &address() const override { return _address; }
- virtual ::dsn::host_port host_port() override { return _hp; }
+ const ::dsn::host_port &host_port() const override { return _hp; }
virtual void inject_drop_message(message_ex *msg, bool is_send) override
{
diff --git a/src/runtime/rpc/network.h b/src/runtime/rpc/network.h
index 3ec3ef42f..5a9bb0609 100644
--- a/src/runtime/rpc/network.h
+++ b/src/runtime/rpc/network.h
@@ -91,8 +91,8 @@ public:
//
// the named address
//
- virtual ::dsn::rpc_address address() = 0;
- virtual ::dsn::host_port host_port() = 0;
+ virtual const ::dsn::rpc_address &address() const = 0;
+ virtual const ::dsn::host_port &host_port() const = 0;
//
// this is where the upper rpc engine calls down for a RPC call
diff --git a/src/runtime/rpc/network.sim.h b/src/runtime/rpc/network.sim.h
index ed91f1f09..f7954afbf 100644
--- a/src/runtime/rpc/network.sim.h
+++ b/src/runtime/rpc/network.sim.h
@@ -91,8 +91,8 @@ public:
virtual error_code start(rpc_channel channel, int port, bool client_only);
- virtual ::dsn::rpc_address address() { return _address; }
- virtual ::dsn::host_port host_port() { return _hp; }
+ const ::dsn::rpc_address &address() const override { return _address; }
+ const ::dsn::host_port &host_port() const override { return _hp; }
virtual rpc_session_ptr create_client_session(::dsn::rpc_address
server_addr)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]