]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: change the signature of get_myaddr()
authorGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 19 Mar 2012 20:12:14 +0000 (13:12 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Tue, 3 Apr 2012 20:11:18 +0000 (13:11 -0700)
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>
src/msg/Messenger.h
src/msg/SimpleMessenger.cc
src/msg/SimpleMessenger.h

index 40abd4b9a9dec72b8af7d374b54f6861d6007fe1..37baccb906a77aaeb0a6c6902b8d1709a11814cf 100644 (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()); }
   
index 7e4acbfde15bcc9fce924d3a25a35e8b0c89f84e..0a642500719420671cf95e4eb42c60b42c17e298 100644 (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;
 }
 
 /**
index 8ab78c9fc1a30d923f6b3edaf8882a5faa3cfb19..12a5a16f7578abe6b1be3c2cad6b88b2b95ab97c 100644 (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.
    *