33 DefragBuffer(NodeId nodeId, Uint32 fragId) :
34 m_fragment_id(fragId), m_node_id(nodeId) {}
38 DefragBuffer* find_buffer(NodeId nodeId, Uint32 fragId){
39 for (
size_t i = 0;
i < m_buffers.size();
i++)
41 DefragBuffer* dbuf = m_buffers[
i];
42 if (dbuf->m_node_id == nodeId &&
43 dbuf->m_fragment_id == fragId)
49 void erase_buffer(
const DefragBuffer* dbuf){
50 for (
size_t i = 0;
i < m_buffers.size();
i++)
52 if (m_buffers[
i] == dbuf)
66 for (
size_t i = m_buffers.size();
i > 0; --
i)
68 delete m_buffers[
i-1];
82 Uint32 fragId = sig->getFragmentId();
83 NodeId nodeId = refToNode(sig->header.theSendersBlockRef);
86 if(sig->isFirstFragment()){
89 if (find_buffer(nodeId, fragId))
92 dbuf =
new DefragBuffer(nodeId, fragId);
93 m_buffers.push_back(dbuf);
96 dbuf = find_buffer(nodeId, fragId);
100 if (dbuf->m_buffer.append(sig->ptr[0].p, sig->ptr[0].sz *
sizeof(Uint32)))
103 if (!sig->isLastFragment())
107 int length = dbuf->m_buffer.length();
108 delete[] sig->ptr[0].p;
109 sig->ptr[0].sz = (length+3)/4;
110 sig->ptr[0].p =
new Uint32[sig->ptr[0].sz];
111 memcpy(sig->ptr[0].p, dbuf->m_buffer.get_data(), length);
122 void node_failed(NodeId nodeId) {
123 for (
size_t i = m_buffers.size();
i > 0; --
i)
125 if (m_buffers[
i-1]->m_node_id == nodeId)