diff options
author | Alan Conway <aconway@apache.org> | 2008-09-06 00:34:58 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2008-09-06 00:34:58 +0000 |
commit | 3bb7782cb0904f0abf61b7fb28da7bce905ceb08 (patch) | |
tree | fcd641905882a5a5bc7a3f6fa8f621b9f15154ce /cpp/src/qpid/cluster/Event.cpp | |
parent | df334f0768c628f2fed8dd350c135d914c54b918 (diff) | |
download | qpid-python-3bb7782cb0904f0abf61b7fb28da7bce905ceb08.tar.gz |
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
Diffstat (limited to 'cpp/src/qpid/cluster/Event.cpp')
-rw-r--r-- | cpp/src/qpid/cluster/Event.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
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<char*>(d), s); + EventType type((EventType)buf.getOctet()); + ConnectionId connection(m, reinterpret_cast<Connection*>(buf.getLongLong())); + assert(buf.getPosition() == OVERHEAD); + Event e(type, connection, s-OVERHEAD); + memcpy(e.getData(), static_cast<char*>(d)+OVERHEAD, s-OVERHEAD); + return e; } void Event::mcast(const Cpg::Name& name, Cpg& cpg) { |