From 3bb7782cb0904f0abf61b7fb28da7bce905ceb08 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Sat, 6 Sep 2008 00:34:58 +0000 Subject: Queue cpg deliveries for execution in separate thread. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@692595 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/cluster/Event.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cpp/src/qpid/cluster/Event.cpp') diff --git a/cpp/src/qpid/cluster/Event.cpp b/cpp/src/qpid/cluster/Event.cpp index ff558842e4..66f3cf261b 100644 --- a/cpp/src/qpid/cluster/Event.cpp +++ b/cpp/src/qpid/cluster/Event.cpp @@ -25,6 +25,7 @@ namespace qpid { namespace cluster { + using framing::Buffer; const size_t Event::OVERHEAD = 1 /*type*/ + 8 /*64-bit pointr*/; @@ -32,10 +33,14 @@ const size_t Event::OVERHEAD = 1 /*type*/ + 8 /*64-bit pointr*/; Event::Event(EventType t, const ConnectionId c, const size_t s) : type(t), connection(c), size(s), data(RefCountedBuffer::create(s)) {} -Event::Event(const MemberId& m, const char* d, size_t s) - : connection(m, 0), size(s-OVERHEAD), data(RefCountedBuffer::create(size)) -{ - memcpy(data->get(), d, s); +Event Event::delivered(const MemberId& m, void* d, size_t s) { + Buffer buf(static_cast(d), s); + EventType type((EventType)buf.getOctet()); + ConnectionId connection(m, reinterpret_cast(buf.getLongLong())); + assert(buf.getPosition() == OVERHEAD); + Event e(type, connection, s-OVERHEAD); + memcpy(e.getData(), static_cast(d)+OVERHEAD, s-OVERHEAD); + return e; } void Event::mcast(const Cpg::Name& name, Cpg& cpg) { -- cgit v1.2.1