lichao
2021-05-18 3788226ee9332945e90066b58f2b85026c2a0460
src/socket.cpp
@@ -162,7 +162,7 @@
{
   size_t size = content.size();
   auto OnResult = [content = std::move(content), msg_id, remote, cb = std::move(cb), this](MsgI &msg) mutable {
      if (!msg.Fill(content)) { return; }
      if (!msg.Fill(content)) { return false; }
      try {
         if (!cb) {
@@ -175,12 +175,23 @@
            };
            Send(remote, msg, onExpireRemoveCB);
         }
         return true;
      } catch (...) {
         SetLastError(eError, "Send internal error.");
         return false;
      }
   };
#if 0
   // self alloc
   MsgI msg;
   if (msg.Make(size)) {
      DEFER1(msg.Release());
      return OnResult(msg);
   }
#else
   // center alloc
   return RequestAlloc(size, OnResult);
#endif
}
bool ShmSocket::RequestAlloc(const int64_t size, std::function<void(MsgI &msg)> const &onResult)