]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Accepter: pass nonce on start
authorSage Weil <sage@inktank.com>
Sat, 11 Aug 2012 14:37:45 +0000 (07:37 -0700)
committerSage Weil <sage@inktank.com>
Mon, 13 Aug 2012 15:46:14 +0000 (08:46 -0700)
This lets us drop the otherwise awkward SimpleMessenger::get_nonce()
accessor.

Signed-off-by: Sage Weil <sage@inktank.com>
src/msg/Accepter.cc
src/msg/Accepter.h
src/msg/SimpleMessenger.cc
src/msg/SimpleMessenger.h

index eb2fccb1424f489f47c76067dba06f36552d9f06..7cff6a8eaf8ea97db8a9e94c68526f487f6ec84f 100644 (file)
@@ -134,7 +134,7 @@ int Accepter::bind(entity_addr_t &bind_addr, int avoid_port1, int avoid_port2)
     msgr->set_need_addr(true);
 
   if (msgr->get_myaddr().get_port() == 0) {
-    listen_addr.nonce = msgr->get_nonce();
+    listen_addr.nonce = nonce;
     msgr->set_myaddr(listen_addr);
   }
 
@@ -158,13 +158,14 @@ int Accepter::rebind(int avoid_port)
   ldout(msgr->cct,10) << " will try " << addr << dendl;
   int r = bind(addr, old_port, avoid_port);
   if (r == 0)
-    start();
+    start(nonce);
   return r;
 }
 
-int Accepter::start()
+int Accepter::start(uint64_t nonce)
 {
   ldout(msgr->cct,1) << "accepter.start" << dendl;
+  this->nonce = nonce;
 
   // start thread
   create();
index 8e947bac598dc67729a97127e27ab85324a35653..e0449ea5459d29f8511dedd0224ee5257ac908c4 100644 (file)
@@ -28,6 +28,7 @@ class Accepter : public Thread {
   SimpleMessenger *msgr;
   bool done;
   int listen_sd;
+  uint64_t nonce;
 
 public:
   Accepter(SimpleMessenger *r) : msgr(r), done(false), listen_sd(-1) {}
@@ -36,7 +37,7 @@ public:
   void stop();
   int bind(entity_addr_t &bind_addr, int avoid_port1=0, int avoid_port2=0);
   int rebind(int avoid_port);
-  int start();
+  int start(uint64_t nonce);
 };
 
 
index b50a44cd7d0be7921bbc765e7ffff3d1f882d83e..a3272b6565a80aac990063fc93b29a96a57ddf3c 100644 (file)
@@ -285,7 +285,7 @@ int SimpleMessenger::start()
   lock.Unlock();
 
   if (did_bind)
-    accepter.start();
+    accepter.start(nonce);
 
   reaper_started = true;
   reaper_thread.create();
index 60ec39dbe561a2d46073081cc150d3c80b1a7ade..26cae4ec74d947c5ee0c3a0877488fb93f0ca2e6 100644 (file)
@@ -482,10 +482,6 @@ public:
   bool get_need_addr() const { return need_addr; }
   void set_need_addr(bool b) { need_addr = b; }
 
-  uint64_t get_nonce() const {
-    return nonce;
-  }
-
 private:
   /**
    *  false; set to true if the SimpleMessenger bound to a specific address;