msgr: change the signature of get_myaddr()

Return a const reference to the actual address, instead of copying it.
All current users are happy with this, and I can't see a good reason
to copy it instead.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
This commit is contained in:
Greg Farnum 2012-03-19 13:12:14 -07:00
parent 45a76eafdd
commit 5681461bf4
3 changed files with 4 additions and 5 deletions

View File

@ -94,7 +94,7 @@ protected:
// accessors
entity_name_t get_myname() { return _my_name; }
virtual entity_addr_t get_myaddr() = 0;
virtual const entity_addr_t& get_myaddr() = 0;
virtual void set_ip(entity_addr_t &addr) = 0;
entity_inst_t get_myinst() { return entity_inst_t(get_myname(), get_myaddr()); }

View File

@ -487,10 +487,9 @@ int SimpleMessenger::lazy_send_message(Message *m, const entity_inst_t& dest)
return 0;
}
entity_addr_t SimpleMessenger::get_myaddr()
const entity_addr_t& SimpleMessenger::get_myaddr()
{
entity_addr_t a = ms_addr;
return a;
return ms_addr;
}
/**

View File

@ -72,7 +72,7 @@ public:
* @return A copy of he address this Messenger currently
* believes to be its own.
*/
virtual entity_addr_t get_myaddr();
virtual const entity_addr_t& get_myaddr();
/**
* Retrieve the Connection for an endpoint.
*