]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Messenger: allow ms_type 'random'
authorSage Weil <sage@redhat.com>
Tue, 21 Oct 2014 15:42:38 +0000 (08:42 -0700)
committerSage Weil <sage@redhat.com>
Tue, 21 Oct 2014 16:55:19 +0000 (09:55 -0700)
Randomly select simple or async, for testing purposes.

Signed-off-by: Sage Weil <sage@redhat.com>
src/msg/Messenger.cc

index 160980c5403f0cc666fd50cc4f0eebe0cedf7735..bd48b3ddd1bc8b377097b2d3d32462de2af016d5 100644 (file)
@@ -10,9 +10,12 @@ Messenger *Messenger::create(CephContext *cct,
                             string lname,
                             uint64_t nonce)
 {
-  if (cct->_conf->ms_type == "simple")
+  int r = -1;
+  if (cct->_conf->ms_type == "random")
+    r = rand() % 2;
+  if (r == 0 || cct->_conf->ms_type == "simple")
     return new SimpleMessenger(cct, name, lname, nonce);
-  else if (cct->_conf->ms_type == "async")
+  else if (r == 1 || cct->_conf->ms_type == "async")
     return new AsyncMessenger(cct, name, lname, nonce);
   lderr(cct) << "unrecognized ms_type '" << cct->_conf->ms_type << "'" << dendl;
   return NULL;