pair<MT_t::waiters_t::iterator, MT_t::waiters_t::iterator> chain=MT->d_waiters.equal_range(pident, PacketIDBirthdayCompare());
for(; chain.first != chain.second; chain.first++) {
- if(chain.first->key.fd > -1) { // don't chain onto existing chained waiter!
+ if(chain.first->key.fd > -1 && !chain.first->key.closed) { // don't chain onto existing chained waiter or a chain already processed
/*
cerr<<"Orig: "<<pident.domain<<", "<<pident.remote.toString()<<", id="<<id<<endl;
cerr<<"Had hit: "<< chain.first->key.domain<<", "<<chain.first->key.remote.toString()<<", id="<<chain.first->key.id
// resend event to everybody chained onto it
static void doResends(MT_t::waiters_t::iterator& iter, PacketID resend, const string& content)
{
+ // We close the chain for new entries, since they won't be processed anyway
+ iter->key.closed = true;
+
if(iter->key.chain.empty())
return;
// cerr<<"doResends called!\n";
struct PacketID
{
- PacketID() : id(0), type(0), sock(0), inNeeded(0), inIncompleteOkay(false), outPos(0), nearMisses(0), fd(-1)
+ PacketID() : id(0), type(0), sock(0), inNeeded(0), inIncompleteOkay(false), outPos(0), nearMisses(0), fd(-1), closed(false)
{
remote.reset();
}
mutable chain_t chain;
mutable uint32_t nearMisses; // number of near misses - host correct, id wrong
int fd;
+ mutable bool closed; // Processing already started, don't accept new chained ids
bool operator<(const PacketID& b) const
{