]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/test: use make_message()
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 5 Sep 2019 03:07:03 +0000 (11:07 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Thu, 5 Sep 2019 03:40:02 +0000 (11:40 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/test/crimson/perf_crimson_msgr.cc
src/test/crimson/test_messenger.cc

index 410843ccf9727f138ff5bdc50e0fe2aa182df9e8..f97787f4760d66401884e9daf36d720ac58153b9 100644 (file)
@@ -150,12 +150,11 @@ static seastar::future<> run(
         const static hobject_t hobj(object_t(), oloc.key, CEPH_NOSNAP, pgid.ps(),
                                     pgid.pool(), oloc.nspace);
         static spg_t spgid(pgid);
-        MOSDOp *rep = new MOSDOp(0, 0, hobj, spgid, 0, 0, 0);
+        auto rep = make_message<MOSDOp>(0, 0, hobj, spgid, 0, 0, 0);
         bufferlist data(msg_data);
         rep->write(0, msg_len, data);
         rep->set_tid(m->get_tid());
-        MessageRef msg = {rep, false};
-        return c->send(msg);
+        return c->send(std::move(rep));
       }
 
       seastar::future<> init(bool v1_crc_enabled, const entity_addr_t& addr) {
@@ -573,11 +572,9 @@ static seastar::future<> run(
           const static hobject_t hobj(object_t(), oloc.key, CEPH_NOSNAP, pgid.ps(),
                                       pgid.pool(), oloc.nspace);
           static spg_t spgid(pgid);
-          MOSDOp *m = new MOSDOp(0, 0, hobj, spgid, 0, 0, 0);
+          auto m = make_message<MOSDOp>(0, 0, hobj, spgid, 0, 0, 0);
           bufferlist data(msg_data);
           m->write(0, msg_len, data);
-          MessageRef msg = {m, false};
-
           // use tid as the identity of each round
           m->set_tid(sent_count);
 
@@ -588,7 +585,7 @@ static seastar::future<> run(
             time_msgs_sent[index] = mono_clock::now();
           }
 
-          return conn->send(msg);
+          return conn->send(std::move(m));
         });
       }
 
index df99077a4df527f068e7254102106199b5218221..d7d3f2ee8fc412ae714a748b6ddb526f6e130bd5 100644 (file)
@@ -443,7 +443,7 @@ seastar::future<> test_preemptive_shutdown(bool v2) {
 
       seastar::future<> ms_dispatch(ceph::net::Connection* c,
                                     MessageRef m) override {
-        return c->send(MessageRef{new MPing, false});
+        return c->send(make_message<MPing>());
       }
 
      public:
@@ -515,7 +515,7 @@ seastar::future<> test_preemptive_shutdown(bool v2) {
           seastar::do_until(
             [this] { return stop_send; },
             [this, conn = &**conn] {
-              return conn->send(MessageRef{new MPing, false}).then([] {
+              return conn->send(make_message<MPing>()).then([] {
                 return seastar::sleep(0ms);
               });
             }