From 0aeaa0f1f197c775ba7dbe922fc4b50ee04924d8 Mon Sep 17 00:00:00 2001 From: mutouyun Date: Tue, 11 Aug 2020 22:54:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3:=201.=20=E6=97=A0=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E8=80=85=E6=97=B6,=20send=20=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=20true;=202.=20Windows=20+=20MSVC=20?= =?UTF-8?q?=E4=B8=8B=E5=88=86=E9=85=8D=E5=99=A8=E7=9A=84=E5=86=85=E5=AD=98?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ipc.cpp | 8 ++++++++ src/memory/allocator_wrapper.h | 6 ++++-- src/memory/wrapper.h | 21 +++------------------ 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/ipc.cpp b/src/ipc.cpp index 6e94f54..04f4a01 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -394,6 +394,14 @@ static bool send(F&& gen_push, ipc::handle_t h, void const * data, std::size_t s ipc::error("fail: send, queue_of(h) == nullptr\n"); return false; } + if (que->elems() == nullptr) { + ipc::error("fail: send, queue_of(h)->elems() == nullptr\n"); + return false; + } + if (que->elems()->connections(std::memory_order_relaxed) == que->connected_id()) { + // there is no receiver on this connection + return false; + } // calc a new message id auto acc = info_of(h)->acc(); if (acc == nullptr) { diff --git a/src/memory/allocator_wrapper.h b/src/memory/allocator_wrapper.h index 5e58f31..1635a21 100755 --- a/src/memory/allocator_wrapper.h +++ b/src/memory/allocator_wrapper.h @@ -20,7 +20,7 @@ struct rebind { using alloc_t = AllocP; }; -template