diff options
| author | Alan Conway <aconway@apache.org> | 2008-12-02 21:43:24 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-12-02 21:43:24 +0000 |
| commit | 081d94d64fa41df6f9661ad31afca0ad71fe9d12 (patch) | |
| tree | 6a4fe30676916a45a8ab2f24a62f768c0e4162c4 /cpp/src/qpid/cluster/Event.cpp | |
| parent | 7cdb9a9ab688988e596d9fce116a0998decd0972 (diff) | |
| download | qpid-python-081d94d64fa41df6f9661ad31afca0ad71fe9d12.tar.gz | |
PollableQueue: fix unsafe use of deque
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@722622 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/Event.cpp')
| -rw-r--r-- | cpp/src/qpid/cluster/Event.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cpp/src/qpid/cluster/Event.cpp b/cpp/src/qpid/cluster/Event.cpp index 87cc7e7bd3..b787ef0f67 100644 --- a/cpp/src/qpid/cluster/Event.cpp +++ b/cpp/src/qpid/cluster/Event.cpp @@ -39,7 +39,8 @@ Event::Event(EventType t, const ConnectionId& c, size_t s, uint32_t i) Event Event::delivered(const MemberId& m, void* d, size_t s) { Buffer buf(static_cast<char*>(d), s); - EventType type((EventType)buf.getOctet()); + EventType type((EventType)buf.getOctet()); + assert(type == DATA || type == CONTROL); ConnectionId connection(m, reinterpret_cast<Connection*>(buf.getLongLong())); uint32_t id = buf.getLong(); assert(buf.getPosition() == OVERHEAD); @@ -62,6 +63,7 @@ bool Event::mcast (Cpg& cpg) const { b.putOctet(type); b.putLongLong(reinterpret_cast<uint64_t>(connectionId.getPointer())); b.putLong(id); + assert(buf.getPosition() == OVERHEAD); iovec iov[] = { { header, OVERHEAD }, { const_cast<char*>(getData()), getSize() } }; return cpg.mcast(iov, sizeof(iov)/sizeof(*iov)); } |
