lichao
2021-04-09 2197cf91e7a3bd5941327ba630a42946b88f069e
src/msg.h
@@ -105,27 +105,21 @@
   bool IsCounted() const { return static_cast<bool>(count_); }
   template <class Body>
   bool Make(SharedMemory &shm, const BHMsgHead &head, const Body &body)
   {
      return Make(shm, Pack(shm, head, body));
   }
   template <class Body>
   bool MakeRC(SharedMemory &shm, const BHMsgHead &head, const Body &body)
   inline bool MakeRC(SharedMemory &shm, const BHMsgHead &head, const Body &body)
   {
      return MakeRC(shm, Pack(shm, head, body));
   }
   bool MakeRC(SharedMemory &shm, MsgI &a)
   bool EnableRefCount(SharedMemory &shm);
   template <class Body>
   inline bool Make(SharedMemory &shm, const BHMsgHead &head, const Body &body)
   {
      if (a.IsCounted()) {
         *this = a;
         AddRef();
         return true;
      } else {
         void *p = a.ptr_.get();
         a.ptr_ = 0;
         return MakeRC(shm, p);
      }
      void *p = Pack(shm, head, body);
      auto NeedRefCount = [&]() { return head.type() == kMsgTypePublish; };
      return NeedRefCount() ? MakeRC(shm, p) : Make(shm, p);
   }
   bool ParseHead(BHMsgHead &head) const;
   template <class Body>
   bool ParseBody(Body &body) const